fixed traffic_in counter in ClientSocket.c
[NeonServV5.git] / src / ClientSocket.c
index 13f8b6b6d55f82b9debe72288f0422f35694f197..a1a5726a567eef6c33ad81e043010276e1329c16 100644 (file)
@@ -61,6 +61,8 @@ void init_sockets() {
 }
 
 struct ClientSocket* create_socket(char *host, int port, char *bindto, char *pass, char *nick, char *ident, char *realname) {
+    if(!sockets)
+        init_sockets();
     struct ClientSocket *client = malloc(sizeof(*client));
     if (!client) {
         return NULL;
@@ -243,6 +245,7 @@ static IOHANDLER_CALLBACK(socket_callback) {
         tid = (unsigned int) pthread_self_tid();
         clientsocket_start_of_recv(tid);
         #endif
+        client->traffic_in += strlen(event->data.recv_str);
         parse_line(client, event->data.recv_str);
         #ifdef HAVE_THREADS
         clientsocket_end_of_recv(tid);