X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fsignal.c;h=bc444465089f1b2faa2f5d3ce03366c3ae3c041a;hb=3ed0a4b0f4ce4dc94ae52dcbd2a18770083241ce;hp=37f66f38671d98cf9f9a911963e7bb96ad26e905;hpb=78e040af3fcc36ab684611c0f98b4381ff420878;p=NeonServV5.git diff --git a/src/signal.c b/src/signal.c index 37f66f3..bc44446 100644 --- a/src/signal.c +++ b/src/signal.c @@ -1,4 +1,4 @@ -/* signal.c - NeonServ v5.5 +/* signal.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -18,6 +18,7 @@ #include "bots.h" #include "ChanNode.h" #include "ClientSocket.h" +#include "IOHandler.h" #include "ConfigParser.h" static void sigcrash(); @@ -85,20 +86,18 @@ static void sigcrash(int signum) { struct ClientSocket *bot; for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { if((bot->flags & SOCKET_FLAG_CONNECTED)) { - close(bot->sock); - bot->flags &= SOCKET_FLAG_CONNECTED; + iohandler_close(bot->iofd); + bot->flags &= ~(SOCKET_FLAG_CONNECTED | SOCKET_FLAG_READY); + bot->iofd = NULL; } } putlog(LOGLEVEL_INFO, "hard shutdown...\n"); - exit_daemon(); usleep(2000000); //hard restart - restart_process(); + restart_bot(1); exit(0); } static void sigexit(int signum) { - cleanup(); - exit_daemon(); - exit(0); + stop_bot(); }