]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn.c
New config option NoDNS: disables all DNS queries.
[ngircd-alex.git] / src / ngircd / conn.c
index b904e2e49689f03c393ebdddab576839cf9f4320..8cd98ab0f2d0f2e8f31a1daabcb422bc39d977b4 100644 (file)
@@ -17,7 +17,7 @@
 #include "portab.h"
 #include "io.h"
 
-static char UNUSED id[] = "$Id: conn.c,v 1.209 2007/05/17 23:34:24 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.213 2007/10/25 11:01:19 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -1039,11 +1039,11 @@ New_Connection( int Sock )
 
        Client_SetHostname( c, My_Connections[new_sock].host );
 
-       Resolve_Addr(&My_Connections[new_sock].res_stat, &new_addr,
-               My_Connections[new_sock].sock, cb_Read_Resolver_Result);
+       if (!Conf_NoDNS)
+               Resolve_Addr(&My_Connections[new_sock].res_stat, &new_addr,
+                       My_Connections[new_sock].sock, cb_Read_Resolver_Result);
 
-       /* Penalty-Zeit setzen */
-       Conn_SetPenalty( new_sock, 4 );
+       Conn_SetPenalty(new_sock, 4);
        return new_sock;
 } /* New_Connection */
 
@@ -1333,7 +1333,7 @@ Check_Servers( void )
                if( Conf_Server[i].group > NONE ) {
                        for (n = 0; n < MAX_SERVERS; n++) {
                                if (n == i) continue;
-                               if ((Conf_Server[n].conn_id > NONE) &&
+                               if ((Conf_Server[n].conn_id != NONE) &&
                                        (Conf_Server[n].group == Conf_Server[i].group))
                                                break;
                        }
@@ -1347,6 +1347,7 @@ Check_Servers( void )
 
                /* Okay, try to connect now */
                Conf_Server[i].lasttry = time_now;
+               Conf_Server[i].conn_id = SERVER_WAIT;
                assert(Resolve_Getfd(&Conf_Server[i].res_stat) < 0);
                Resolve_Name(&Conf_Server[i].res_stat, Conf_Server[i].host, cb_Connect_to_Server);
        }
@@ -1448,14 +1449,17 @@ New_Server( int Server )
 } /* New_Server */
 
 
+/**
+ * Initialize connection structure.
+ */
 static void
-Init_Conn_Struct( CONN_ID Idx )
+Init_Conn_Struct(CONN_ID Idx)
 {
-       time_t now = time( NULL );
-       /* Connection-Struktur initialisieren */
+       time_t now = time(NULL);
 
-       memset( &My_Connections[Idx], 0, sizeof ( CONNECTION ));
+       memset(&My_Connections[Idx], 0, sizeof(CONNECTION));
        My_Connections[Idx].sock = -1;
+       My_Connections[Idx].signon = now;
        My_Connections[Idx].lastdata = now;
        My_Connections[Idx].lastprivmsg = now;
        Resolve_Init(&My_Connections[Idx].res_stat);