]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn.c
removed obsolete "int Conn_MaxFD"
[ngircd-alex.git] / src / ngircd / conn.c
index 0c3f4fcee70f705a4a5acff9c92238d682336689..bff3db61149f19cdb376afcb41f5f09d054a44c5 100644 (file)
@@ -17,7 +17,7 @@
 #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>
@@ -158,9 +158,6 @@ cb_connserver(int sock, UNUSED short what)
  
                Conn_Close(idx, "Can't connect!", NULL, false);
  
-               /* Set the timestamp of the last connect attempt */
-               Conf_UnsetServer(idx);
-
                return;
        }
 
@@ -231,9 +228,6 @@ Conn_Init( void )
 
        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 );
 
@@ -465,7 +459,9 @@ Conn_Handler( void )
 #endif
 
                /* Should the configuration be reloaded? */
-               if( NGIRCd_SignalRehash ) NGIRCd_Rehash( );
+               if (NGIRCd_SignalRehash) {
+                       NGIRCd_Rehash( );
+               }
 
                /* Check configured servers and established links */
                Check_Servers( );
@@ -814,10 +810,10 @@ Conn_SyncServerStruct( void )
        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 );
@@ -1560,15 +1556,15 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
 
        /* 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';
@@ -1613,6 +1609,16 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
 
        /* 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 */