#include "portab.h"
#include "io.h"
-static char UNUSED id[] = "$Id: conn.c,v 1.184 2005/10/11 19:29:23 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.187 2006/02/02 21:00:21 fw Exp $";
#include "imp.h"
#include <assert.h>
Conn_Close(idx, "Can't connect!", NULL, false);
- /* Set the timestamp of the last connect attempt */
- Conf_UnsetServer(idx);
-
return;
}
array_free( &My_Listeners );
- /* Groesster File-Descriptor fuer select() */
- Conn_MaxFD = 0;
-
/* Connection-Struktur initialisieren */
for( i = 0; i < Pool_Size; i++ ) Init_Conn_Struct( i );
#endif
/* Should the configuration be reloaded? */
- if( NGIRCd_SignalRehash ) NGIRCd_Rehash( );
+ if (NGIRCd_SignalRehash) {
+ NGIRCd_Rehash( );
+ }
/* Check configured servers and established links */
Check_Servers( );
CONN_ID i;
int c;
- for( i = 0; i < Pool_Size; i++ )
- {
+ for( i = 0; i < Pool_Size; i++ ) {
/* Established connection? */
- if( My_Connections[i].sock <= NONE ) continue;
+ if (My_Connections[i].sock < 0)
+ continue;
/* Server connection? */
client = Client_GetFromConn( i );
/* Read result from pipe */
len = Resolve_Read(&My_Connections[i].res_stat, readbuf, sizeof readbuf -1);
- if (len == 0)
- return;
+ if (len == 0)
+ goto out;
readbuf[len] = '\0';
identptr = strchr(readbuf, '\n');
assert(identptr != NULL);
if (!identptr) {
Log( LOG_CRIT, "Resolver: Got malformed result!");
- return;
+ goto out;
}
*identptr = '\0';
/* Reset penalty time */
Conn_ResetPenalty( i );
+ return;
+out:
+ if (My_Connections[i].sock == SERVER_WAIT) {
+ n = Conf_GetServer( i );
+ assert(n > NONE );
+ if (n > NONE) {
+ Conf_Server[n].conn_id = NONE;
+ Init_Conn_Struct(i);
+ }
+ }
} /* cb_Read_Resolver_Result */