summaryrefslogtreecommitdiff
path: root/src/server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cc')
-rw-r--r--src/server.cc31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/server.cc b/src/server.cc
index cdbe506..5e3126b 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.22 2005/06/14 12:29:40 deva
+ * Incorporated the use of the Info object everywhere... also using the log functionality.
+ *
* Revision 1.21 2005/05/26 21:32:39 deva
* *** empty log message ***
*
@@ -92,9 +95,12 @@
// For unlink
#include <unistd.h>
+// For errno
+#include <errno.h>
+
+
#include "miav_config.h"
-//#include "mov_encoder.h"
#include "mov_encoder_thread.h"
#include "img_encoder.h"
@@ -102,8 +108,6 @@
#include "dv.h"
-#include "info_console.h"
-
void saveFrameAsImage(char* cpr, Frame *f)
{
ImgEncoder imgenc;
@@ -208,6 +212,7 @@ struct tm
MovEncoderThread *newMovEncoder(char* cpr)
{
+ /*
MovEncoderThread *enc;
struct tm *ltime;
time_t t = time(NULL);
@@ -293,14 +298,15 @@ MovEncoderThread *newMovEncoder(char* cpr)
fprintf(stderr, "Success - using filename: [%s.mpg]\n", fname); fflush(stderr);
enc = new MovEncoderThread(fname);
return enc;
+*/
+ return NULL;
}
-void newConnection(Socket *socket)
+void newConnection(Socket *socket, Info *info)
{
char cpr[256];
bool hasCpr = false;
ServerStatus status;
- InfoConsole info;
n_savestate savestate = LATER;
n_header h;
@@ -311,15 +317,13 @@ void newConnection(Socket *socket)
frame = new Frame(NULL, DVPACKAGE_SIZE);
- fprintf(stderr, "New connection[pid: %d]...\n", getpid());
- fflush(stderr);
+ info->log("New connection");
- Network network = Network(socket, &info);
+ Network network = Network(socket, info);
while(int ret = network.recvPackage(&h, frame->data, frame->size)) {
status.checkPoint();
if(ret == -1) {
- fprintf(stderr, "An error occurred...!\n");
- fflush(stderr);
+ info->error("A network error ocurred, terminating session");
break;
}
@@ -358,7 +362,8 @@ void newConnection(Socket *socket)
// This one must be last!
if(h.header.h_data.record) {
- if(!enc) enc = newMovEncoder(cpr);
+ // if(!enc) enc = newMovEncoder(cpr);
+ if(!enc) enc = new MovEncoderThread(cpr, info);
enc->encode(frame);
}
@@ -367,10 +372,10 @@ void newConnection(Socket *socket)
// TODO: Use save state
- fprintf(stderr, "Closing connection...\n"); fflush(stderr);
+ info->log("Closing connection...");
if(enc) delete enc;
- fprintf(stderr, "Connection closed [pid: %d]...\n", getpid()); fflush(stderr);
+ info->log("Connection closed");
}