push
[NextIRCd.git] / src / ircd_sock.c
index a61686f5a22b089034b2b2d935f142e7b2d2fa62..920479d8d73b7783cc7b0abdce2c8d8db00349a5 100644 (file)
 #include "ircd_parse.h"
 #include "ircd_auth.h"
 #include "struct_connection.h"
+#include "struct_client.h"
+#include "struct_auth.h"
 
 #include "IOHandler/IOSockets.h"
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 #include <stdio.h> // @debug
 
 static struct Connection *sockets_listening = NULL;
@@ -131,6 +134,7 @@ static void sockets_accept_client(struct IOSocket *new_client, struct Connection
     new_client->parse_delimiter = 1;
     new_client->parse_empty = 0;
     strcpy((char*) new_client->delimiters, "\r\n");
+       new_client->callback = sockets_iohandler_callback;
     
     connection->parent = listener;
     new_client->data = connection;
@@ -196,7 +200,6 @@ static IOSOCKET_CALLBACK(sockets_iohandler_callback) {
             // listening socket could not be opened
         } else {
             sockets_remove_list(connection);
-            client_disconnected(connection);
             sockets_free_connection(connection);
         }
         break;
@@ -227,7 +230,7 @@ void socket_printf(struct Connection *conn, const char *text, ...) {
        va_start(arg_list, text);
        pos = vsnprintf(sendBuf, 512 - 2, text, arg_list);
        va_end(arg_list);
-       if (pos < 0 || pos > (512 - 2)) pos = CLIENT_MAXLEN - 2;
+       if (pos < 0 || pos > (512 - 2)) pos = 512 - 2;
        sendBuf[pos] = '\n';
     sendBuf[pos+1] = '\0';
        iosocket_send(conn->socket, sendBuf, pos+1);