summaryrefslogtreecommitdiff
path: root/src/server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cc')
-rw-r--r--src/server.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/server.cc b/src/server.cc
index 3370586..3bfd1a2 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -83,22 +83,26 @@ void newConnection(Socket *socket)
Frame *frame;
Frame *freeze_frame = NULL;
MovEncoder *enc = NULL;
+ unsigned char dvbuf[DVPACKAGE_SIZE];
- frame = new Frame((unsigned char *)malloc(DVPACKAGE_SIZE), DVPACKAGE_SIZE);
+ // frame = new Frame((unsigned char *)malloc(DVPACKAGE_SIZE), DVPACKAGE_SIZE);
printf("New connection[pid: %d]...\n", getpid());
Network network = Network(socket);
- while(int ret = network.recvPackage(&h, frame->data, DVPACKAGE_SIZE)) {
+ while(int ret = network.recvPackage(&h, dvbuf, DVPACKAGE_SIZE)) {
if(ret == -1) {
fprintf(stderr, "An error occurred...!\n");
break;
}
- printf("Read: %d bytes\t", ret);
- printf("\ttyp: %d\t", h.header_type);
- printf("\tcpr: %s\t", h.header.h_data.cpr);
- printf("\tfrz: %d\t", h.header.h_data.freeze);
- printf("\tsht: %d\n", h.header.h_data.snapshot);
+
+ 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);
+ printf("\tfrz: %d ", h.header.h_data.freeze);
+ printf("\tsht: %d ", h.header.h_data.snapshot);
printf("\tsave: %d\n", h.header.h_data.savestate);
if(h.header.h_data.snapshot) {
@@ -126,13 +130,10 @@ void newConnection(Socket *socket)
} else {
delete frame;
}
-
- frame = new Frame((unsigned char *)malloc(DVPACKAGE_SIZE), DVPACKAGE_SIZE);
}
// TODO: Use save state
- delete frame;
if(enc) delete enc;
printf("Connection end[pid: %d]...\n", getpid());