From 0332e496347f6b563abb86d4ef9650bbd6ebc3e1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 28 May 2014 15:05:57 +0200 Subject: Port server to hugin. --- src/server.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/server.cc') diff --git a/src/server.cc b/src/server.cc index 45d8b48..69e45b6 100644 --- a/src/server.cc +++ b/src/server.cc @@ -44,6 +44,8 @@ #include #include +#include + #include "miav_config.h" #include "mov_encoder_thread.h" @@ -54,12 +56,12 @@ #include "dv.h" #include "network.h" -void newConnection(Socket *socket, Info *info) +void newConnection(Socket *socket) { char cpr[256]; char clientip[64]; bool hasCpr = false; - ServerStatus status(info); + ServerStatus status; n_savestate savestate = LATER; n_header h; @@ -69,17 +71,17 @@ void newConnection(Socket *socket, Info *info) frame = new Frame(NULL, DVPACKAGE_SIZE); - info->info("CONNECTION OPENED"); - info->info("New connection (%s)", inet_ntoa(socket->socketaddr.sin_addr)); + INFO(connection, "CONNECTION OPENED"); + INFO(connection, "New connection (%s)", inet_ntoa(socket->socketaddr.sin_addr)); sprintf(clientip, "%s", inet_ntoa(socket->socketaddr.sin_addr)); - Network network = Network(socket, info); + Network network = Network(socket); while(int ret = network.recvPackage(&h, frame->data, frame->size)) { status.checkPoint(); if(ret == -1) { - info->error("A network error ocurred, terminating session"); + ERR(connection, "A network error ocurred, terminating session"); break; } @@ -92,17 +94,17 @@ void newConnection(Socket *socket, Info *info) if(h.header.h_data.snapshot) { if(freeze_frame) { - ImgEncoder(cpr, info).encode(freeze_frame, 100); + ImgEncoder(cpr).encode(freeze_frame, 100); delete freeze_frame; freeze_frame = NULL; } else { - ImgEncoder(cpr, info).encode(frame, 100); + ImgEncoder(cpr).encode(frame, 100); } } if(h.header.h_data.savestate != NO_CHANGE) { savestate = h.header.h_data.savestate; - info->info("GOT SAVESTATE FROM NETWORK: %d", savestate ); + INFO(connecion, "GOT SAVESTATE FROM NETWORK: %d", savestate ); } if(h.header.h_data.freeze) { @@ -114,14 +116,14 @@ void newConnection(Socket *socket, Info *info) // This one must be last! if(h.header.h_data.record) { // if(!enc) enc = newMovEncoder(cpr); - if(!enc) enc = new MovEncoderThread(clientip, cpr, info); + if(!enc) enc = new MovEncoderThread(clientip, cpr); enc->encode(frame); } frame = new Frame(NULL, DVPACKAGE_SIZE); } - info->info("Closing connection..."); + INFO(connection, "Closing connection..."); // No encoder exists, if this is a pure snapshot (image) connection. if(enc) { @@ -132,5 +134,5 @@ void newConnection(Socket *socket, Info *info) delete enc; } - info->info("CONNECTION CLOSED"); + INFO(connection, "CONNECTION CLOSED"); } -- cgit v1.2.3