From 430524810e67d3c223a2ab819f45b882b419c45d Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 14 Jun 2005 12:29:40 +0000 Subject: Incorporated the use of the Info object everywhere... also using the log functionality. --- src/miav_daemon.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/miav_daemon.cc') diff --git a/src/miav_daemon.cc b/src/miav_daemon.cc index 633ab7d..2d679c3 100644 --- a/src/miav_daemon.cc +++ b/src/miav_daemon.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.2 2005/06/14 12:29:40 deva + * Incorporated the use of the Info object everywhere... also using the log functionality. + * * Revision 1.1 2005/06/09 11:00:03 deva * Added daemon code, and cleaned up using -Wall and -Werror * @@ -45,6 +48,9 @@ #include "server.h" #include "socket.h" +#include +#include + MiavDaemon::MiavDaemon() {} @@ -53,7 +59,8 @@ MiavDaemon::~MiavDaemon() int MiavDaemon::daemon_main() { - InfoConsole info; + MiavConfig cfg(ETC"/miav.conf", NULL); + InfoConsole info(&cfg); config = new MiavConfig(ETC"/miav.conf", &info); int port = config->readInt("server_port"); @@ -62,7 +69,7 @@ int MiavDaemon::daemon_main() signal(SIGCLD, SIG_IGN); // Ved SIGCHILD til IGNORE maa wait/waitpid ikke kaldes // (ellers kommer der kernel-brok) - printf("Listening on port %d\n", port); + info.log("Listening on port %d", port); Socket *socket = new Socket(port, &info); while(1) { @@ -72,11 +79,11 @@ int MiavDaemon::daemon_main() switch(childpid) { case -1: // fork() returns -1 on failure - perror("fork"); + info.log("Fork error: %s", strerror(errno)); exit(1); case 0: // fork() returns 0 to the child process delete socket; // Close listen socket. - newConnection(csocket); + newConnection(csocket, &info); delete csocket; // Close communication socket. exit(0); -- cgit v1.2.3