X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=60128eae429d3439025dc7d558485c9a8be9ae23;hb=1b852fce72a87f3cce2049fde59ab66b6bbda6ca;hp=30b86b1adf8700f7b2b10006b4d67d62a6b1a1c8;hpb=d2f7d3087dc6c1522aef8b24e1faf1d9ffe2c139;p=ngircd-alex.git diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 30b86b1a..60128eae 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -17,7 +17,7 @@ #include "portab.h" #include "io.h" -static char UNUSED id[] = "$Id: conn.c,v 1.199 2006/12/17 22:55:07 fw Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.201 2006/12/25 01:11:12 fw Exp $"; #include "imp.h" #include @@ -995,16 +995,22 @@ New_Connection( int Sock ) Init_Conn_Struct(Pool_Size++); } + /* register callback */ + if (!io_event_create( new_sock, IO_WANTREAD, cb_clientserver)) { + Log(LOG_ALERT, "Can't accept connection: io_event_create failed!"); + Simple_Message(new_sock, "ERROR :Internal error"); + close(new_sock); + return -1; + } + c = Client_NewLocal( new_sock, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWN, false ); if( ! c ) { - Log( LOG_ALERT, "Can't accept connection: can't create client structure!" ); - goto out; + Log(LOG_ALERT, "Can't accept connection: can't create client structure!"); + Simple_Message(new_sock, "ERROR :Internal error"); + io_close(new_sock); + return -1; } - /* register callback */ - if (!io_event_create( new_sock, IO_WANTREAD, cb_clientserver)) - goto out; - Init_Conn_Struct( new_sock ); My_Connections[new_sock].sock = new_sock; My_Connections[new_sock].addr = new_addr; @@ -1025,11 +1031,7 @@ New_Connection( int Sock ) /* Penalty-Zeit setzen */ Conn_SetPenalty( new_sock, 4 ); return new_sock; - out: - Simple_Message( new_sock, "ERROR :Internal error" ); - close( new_sock ); - return -1; -}/* New_Connection */ +} /* New_Connection */ static CONN_ID