summaryrefslogtreecommitdiff
path: root/src/miav_daemon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/miav_daemon.cc')
-rw-r--r--src/miav_daemon.cc37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/miav_daemon.cc b/src/miav_daemon.cc
index c044ed9..06a0e53 100644
--- a/src/miav_daemon.cc
+++ b/src/miav_daemon.cc
@@ -24,20 +24,18 @@
* along with MIaV; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include <config.h>
#include "miav_daemon.h"
-#include "info_console.h"
-#include "miav_config.h"
-
-#include "server.h"
-#include "socket.h"
-
#include <signal.h>
#include <errno.h>
-
#include <stdlib.h>
+#include <hugin.hpp>
+
+#include "miav_config.h"
+#include "server.h"
+#include "socket.h"
+
MiavDaemon::MiavDaemon()
{}
@@ -46,9 +44,8 @@ MiavDaemon::~MiavDaemon()
int MiavDaemon::daemon_main()
{
- MiavConfig cfg(ETC"/miav.conf", NULL);
- InfoConsole info(&cfg);
- config = new MiavConfig(ETC"/miav.conf", &info);
+ MiavConfig cfg(ETC"/miav.conf");
+ config = new MiavConfig(ETC"/miav.conf");
int port = config->readInt("server_port");
pid_t childpid; // variable to store the child's pid
@@ -56,12 +53,12 @@ int MiavDaemon::daemon_main()
signal(SIGCLD, SIG_IGN); // Ved SIGCHILD til IGNORE maa wait/waitpid ikke kaldes
// (ellers kommer der kernel-brok)
- info.info("Starting MIaV server v. %s", VERSION);
- info.info("Listening on port %d", port);
- Socket *socket = new Socket(port, &info);
+ INFO(miav, "Starting MIaV server v. %s", VERSION);
+ INFO(miav, "Listening on port %d", port);
+ Socket *socket = new Socket(port);
if(socket->hasError()) {
- info.error("Listening socket has errors, quitting.");
+ ERR(miav, "Listening socket has errors, quitting.");
delete socket;
return 1;
}
@@ -70,19 +67,19 @@ int MiavDaemon::daemon_main()
Socket *csocket = new Socket(socket->slisten());
if(socket->hasError()) {
- info.error("Server socket has errors, quitting.");
+ ERR(miav, "Server socket has errors, quitting.");
delete csocket;
break;
}
if(csocket->hasError()) {
- info.error("Child socket has errors, quitting.");
+ ERR(miav, "Child socket has errors, quitting.");
delete csocket;
break;
}
if(!csocket->isConnected()) {
- info.error("Child socket is not connected, quitting.");
+ ERR(miav, "Child socket is not connected, quitting.");
delete csocket;
break;
}
@@ -91,11 +88,11 @@ int MiavDaemon::daemon_main()
switch(childpid) {
case -1: // fork() returns -1 on failure
- info.log("Fork error: %s", strerror(errno));
+ ERR(miav, "Fork error: %s", strerror(errno));
exit(1);
case 0: // fork() returns 0 to the child process
delete socket; // Close listen socket.
- newConnection(csocket, &info);
+ newConnection(csocket);
delete csocket; // Close communication socket.
exit(0);