diff options
Diffstat (limited to 'src/server.cc')
-rw-r--r-- | src/server.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/server.cc b/src/server.cc index 3bfd1a2..d603b41 100644 --- a/src/server.cc +++ b/src/server.cc @@ -32,6 +32,8 @@ #include "mov_encoder.h" #include "img_encoder.h" +#include "server_status.h" + #include "dv.h" void saveFrameAsImage(char* cpr, Frame *f) @@ -78,26 +80,27 @@ MovEncoder *newMovEncoder(char* cpr) void newConnection(Socket *socket) { + ServerStatus status; + n_savestate savestate = LATER; n_header h; Frame *frame; Frame *freeze_frame = NULL; MovEncoder *enc = NULL; - unsigned char dvbuf[DVPACKAGE_SIZE]; + // unsigned char dvbuf[DVPACKAGE_SIZE]; - // frame = new Frame((unsigned char *)malloc(DVPACKAGE_SIZE), DVPACKAGE_SIZE); + frame = new Frame(NULL, DVPACKAGE_SIZE); printf("New connection[pid: %d]...\n", getpid()); Network network = Network(socket); - while(int ret = network.recvPackage(&h, dvbuf, DVPACKAGE_SIZE)) { + while(int ret = network.recvPackage(&h, frame->data, frame->size)) { + status.checkPoint(); if(ret == -1) { fprintf(stderr, "An error occurred...!\n"); break; } - frame = new Frame(dvbuf, DVPACKAGE_SIZE); - printf("Read: %d bytes ", ret); printf("\ttyp: %d ", h.header_type); printf("\tcpr: %s ", h.header.h_data.cpr); @@ -130,6 +133,8 @@ void newConnection(Socket *socket) } else { delete frame; } + + frame = new Frame(NULL, DVPACKAGE_SIZE); } // TODO: Use save state |