]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn.c
- Nick-Aenderungen: Log-Eintrag nur noch im Debug-Modus bzw. fuer lokale User.
[ngircd-alex.git] / src / ngircd / conn.c
index e7a756695fa33ed7a91645af250aaf9e23701c0a..4c0df7293ab1f59cce239e4b823e941fec6d8c55 100644 (file)
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conn.c,v 1.52 2002/03/12 14:37:52 alex Exp $
+ * $Id: conn.c,v 1.56 2002/03/14 13:42:33 alex Exp $
  *
  * connect.h: Verwaltung aller Netz-Verbindungen ("connections")
  */
@@ -54,7 +54,7 @@
 #include "conn.h"
 
 
-#define SERVER_WAIT NONE - 1
+#define SERVER_WAIT (NONE - 1)
 
 
 typedef struct _Connection
@@ -332,6 +332,10 @@ GLOBAL BOOLEAN Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... )
        BOOLEAN ok;
        va_list ap;
 
+       assert( Idx >= 0 );
+       assert( My_Connections[Idx].sock > NONE );
+       assert( Format != NULL );
+       
        va_start( ap, Format );
        if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) == COMMAND_LEN - 2 )
        {
@@ -850,8 +854,10 @@ LOCAL VOID Check_Servers( VOID )
                /* Haben wir schon eine Verbindung? */
                for( n = 0; n < MAX_CONNECTIONS; n++ )
                {
+                       if( My_Connections[n].sock == NONE ) continue;
+                       
                        /* Verbindung zu diesem Server? */
-                       if(( My_Connections[n].sock != NONE ) && ( My_Connections[n].our_server == i ))
+                       if( My_Connections[n].our_server == i )
                        {
                                /* Komplett aufgebaute Verbindung? */
                                if( My_Connections[n].sock > NONE ) break;
@@ -861,9 +867,9 @@ LOCAL VOID Check_Servers( VOID )
                        }
 
                        /* Verbindung in dieser Server-Gruppe? */
-                       if(( My_Connections[n].sock != NONE ) && ( My_Connections[n].our_server != NONE ))
+                       if(( My_Connections[n].our_server != NONE ) && ( Conf_Server[i].group != NONE ))
                        {
-                               if( Conf_Server[n].group == Conf_Server[i].group != NONE ) break;
+                               if( Conf_Server[My_Connections[n].our_server].group == Conf_Server[i].group ) break;
                        }
                }
                if( n < MAX_CONNECTIONS ) continue;
@@ -1007,12 +1013,14 @@ LOCAL BOOLEAN Init_Socket( INT Sock )
 
        INT on = 1;
 
+#ifdef O_NONBLOCK      /* A/UX kennt das nicht? */
        if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 )
        {
                Log( LOG_CRIT, "Can't enable non-blocking mode: %s!", strerror( errno ));
                close( Sock );
                return FALSE;
        }
+#endif
        if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &on, (socklen_t)sizeof( on )) != 0)
        {
                Log( LOG_ERR, "Can't set socket options: %s!", strerror( errno ));