From 5db7ffe3eaf08c7346f5b8507d0af7b1fb77dd15 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sat, 18 Feb 2012 02:46:05 +0100 Subject: [PATCH] fixed unwanted shutdowns due "no more bots running" --- src/ClientSocket.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ClientSocket.c b/src/ClientSocket.c index 6cf36e2..c6ac27a 100644 --- a/src/ClientSocket.c +++ b/src/ClientSocket.c @@ -106,6 +106,7 @@ int connect_socket(struct ClientSocket *client) { #ifndef WIN32 static int _connect_socket(struct ClientSocket *client) { if((client->flags & SOCKET_FLAG_CONNECTED)) return 1; + client->connection_time = time(0); int sock; struct addrinfo hints, *res; @@ -207,7 +208,6 @@ static int _connect_socket(struct ClientSocket *client) { client->sock = sock; client->flags |= SOCKET_FLAG_CONNECTED | SOCKET_FLAG_RECONNECT; - client->connection_time = time(0); if(client->flags & SOCKET_FLAG_SSL) { ssl_connect(client); @@ -233,6 +233,7 @@ static int _connect_socket(struct ClientSocket *client) { #else static int _connect_socket(struct ClientSocket *client) { if((client->flags & SOCKET_FLAG_CONNECTED)) return 1; + client->connection_time = time(0); struct hostent *host; struct sockaddr_in addr; int sock; @@ -262,7 +263,6 @@ static int _connect_socket(struct ClientSocket *client) { client->sock = sock; client->flags |= SOCKET_FLAG_CONNECTED | SOCKET_FLAG_RECONNECT; - client->connection_time = time(0); if(client->flags & SOCKET_FLAG_SSL) { @@ -445,10 +445,6 @@ int socket_loop(int timeout_seconds) { timeout.tv_sec = timeout_seconds; timeout.tv_usec = 0; ret = select(ret + 1, &fds, NULL, NULL, &timeout); - if(ret == 0) { - DESYNCHRONIZE(synchronized_recv); - return 1; - } for (sock = sockets->data; sock; sock = next) { next = sock->next; if((sock->flags & (SOCKET_FLAG_CONNECTED | SOCKET_FLAG_QUITTED)) == SOCKET_FLAG_CONNECTED && FD_ISSET(sock->sock, &fds)) { @@ -538,7 +534,7 @@ int socket_loop(int timeout_seconds) { if(is_synchronized) { DESYNCHRONIZE(synchronized_recv); } - return (ret + 1); + return 1; } void -- 2.20.1