commit 1e29560bac65669fce73ded5e1ebb006ceb3fb6c from: Florian Westphal date: Sun Dec 17 23:00:47 2006 UTC do not call Conn_Close when io_event_create fails [from HEAD] commit - 880d4a88b10d2e520d5476ac8627d425884658f9 commit + 1e29560bac65669fce73ded5e1ebb006ceb3fb6c blob - 3938babbba1d5fa8558189d565afc5948f2a140f blob + f36637b66eb8ddc2ba0d43472b5f611376f6688c --- src/ngircd/conn.c +++ src/ngircd/conn.c @@ -17,7 +17,7 @@ #include "portab.h" #include "io.h" -static char UNUSED id[] = "$Id: conn.c,v 1.198 2006/07/23 23:05:20 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.198.2.1 2006/12/17 23:00:47 fw Exp $"; #include "imp.h" #include @@ -998,23 +998,18 @@ New_Connection( int Sock ) 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!" ); - Simple_Message( new_sock, "ERROR :Internal error" ); - close( new_sock ); - return -1; + goto out; } + /* 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; My_Connections[new_sock].client = c; - /* register callback */ - if (!io_event_create( new_sock, IO_WANTREAD, cb_clientserver)) { - Simple_Message( new_sock, "ERROR :Internal error" ); - Conn_Close( new_sock, "io_event_create() failed", NULL, false ); - return -1; - } - Log( LOG_INFO, "Accepted connection %d from %s:%d on socket %d.", new_sock, inet_ntoa( new_addr.sin_addr ), ntohs( new_addr.sin_port), Sock ); @@ -1030,7 +1025,11 @@ New_Connection( int Sock ) /* Penalty-Zeit setzen */ Conn_SetPenalty( new_sock, 4 ); return new_sock; -} /* New_Connection */ + out: + Simple_Message( new_sock, "ERROR :Internal error" ); + close( new_sock ); + return -1; +}/* New_Connection */ static CONN_ID