X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FClientSocket.c;h=d8faf26d4a0ec7c56ae3475f083b300300517df3;hb=ee39770362f69ced5b52104b622582e882af0b77;hp=7160014d36c18b089720ddf1e05f74743f4f9724;hpb=8ce78bf760720d04385821abba8f888b5de03140;p=NeonServV5.git diff --git a/src/ClientSocket.c b/src/ClientSocket.c index 7160014..d8faf26 100644 --- a/src/ClientSocket.c +++ b/src/ClientSocket.c @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#include "main.h" #include "ClientSocket.h" #include "IRCParser.h" #include "UserNode.h" @@ -25,6 +25,7 @@ #include "version.h" #include "IOHandler.h" #include "IRCEvents.h" +#include "log.h" struct socket_list { struct ClientSocket *data; @@ -54,7 +55,7 @@ void init_sockets() { sockets = malloc(sizeof(*sockets)); if (!sockets) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return; } sockets->data = NULL; @@ -156,9 +157,9 @@ int write_socket_force(struct ClientSocket *client, char* msg, int len) { if(!(client && (client->flags & SOCKET_FLAG_CONNECTED))) return 0; SYNCHRONIZE(synchronized); #ifdef HAVE_THREADS - putlog(LOGLEVEL_RAW, "[%d send %d] %s", getCurrentThreadID(), len, msg); + printf_log("main", LOG_IRCRAW, "[%d send %d] %s", getCurrentThreadID(), len, msg); #else - putlog(LOGLEVEL_RAW, "[send %d] %s", len, msg); + printf_log("main", LOG_IRCRAW, "[send %d] %s", len, msg); #endif iohandler_send(client->iofd, msg, len); client->traffic_out += len; @@ -222,6 +223,8 @@ static IOHANDLER_CALLBACK(socket_callback) { #ifdef HAVE_THREADS unsigned int tid; #endif + if(process_state.running == 0) + return; //just ignore the event (shutdown sequence) switch(event->type) { case IOEVENT_CONNECTED: client->flags |= SOCKET_FLAG_CONNECTED;