summaryrefslogtreecommitdiff
path: root/server/server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.cc')
-rw-r--r--server/server.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/server/server.cc b/server/server.cc
index e306cf1..9af22d9 100644
--- a/server/server.cc
+++ b/server/server.cc
@@ -46,6 +46,7 @@
#include <arpa/inet.h>
#include "miav_config.h"
+#include "info.h"
#include "mov_encoder_thread.h"
#include "img_encoder.h"
@@ -54,12 +55,12 @@
#include "dv.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 +70,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));
+ MIaV::info->info("CONNECTION OPENED");
+ MIaV::info->info("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");
+ MIaV::info->error("A network error ocurred, terminating session");
break;
}
@@ -92,17 +93,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 );
+ MIaV::info->info("GOT SAVESTATE FROM NETWORK: %d", savestate );
}
if(h.header.h_data.freeze) {
@@ -114,14 +115,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...");
+ MIaV::info->info("Closing connection...");
// No encoder exists, if this is a pure snapshot (image) connection.
if(enc) {
@@ -132,5 +133,5 @@ void newConnection(Socket *socket, Info *info)
delete enc;
}
- info->info("CONNECTION CLOSED");
+ MIaV::info->info("CONNECTION CLOSED");
}