summaryrefslogtreecommitdiff
path: root/src/miav_daemon.cc
diff options
context:
space:
mode:
authordeva <deva>2005-06-14 12:29:40 +0000
committerdeva <deva>2005-06-14 12:29:40 +0000
commit430524810e67d3c223a2ab819f45b882b419c45d (patch)
tree0abb4b2dd3dabc414c755c30e52d0b5022ee8670 /src/miav_daemon.cc
parent0836a6e06f86e366017da3b2b2c132b3a4f2c877 (diff)
Incorporated the use of the Info object everywhere... also using the log functionality.
Diffstat (limited to 'src/miav_daemon.cc')
-rw-r--r--src/miav_daemon.cc15
1 files changed, 11 insertions, 4 deletions
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 <signal.h>
+#include <errno.h>
+
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);