From f3833f876d4d7dff6e247123c7e9ad633a625b74 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 26 Apr 2005 10:17:04 +0000 Subject: *** empty log message *** --- src/server.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/server.cc') 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()); -- cgit v1.2.3