]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn.c
Clean up and document IRC_JOIN() and join_allowed() functions
[ngircd-alex.git] / src / ngircd / conn.c
index 7b07114b0730fede7080ae8246bc8c3dcbabbf92..1e4ba0abd7604397e3ad8fa2d2a8ba1b84343be8 100644 (file)
@@ -124,9 +124,7 @@ static void
 cb_listen(int sock, short irrelevant)
 {
        (void) irrelevant;
-       if (New_Connection( sock ) >= 0)
-               NumConnections++;
-       LogDebug("Total number of connections now %ld.", NumConnections);
+       (void) New_Connection(sock);
 }
 
 
@@ -146,9 +144,6 @@ cb_listen_ssl(int sock, short irrelevant)
        fd = New_Connection(sock);
        if (fd < 0)
                return;
-
-       NumConnections++;
-       LogDebug("Total number of connections now %ld.", NumConnections);
        io_event_setcb(My_Connections[fd].sock, cb_clientserver_ssl);
 }
 #endif
@@ -1361,6 +1356,9 @@ New_Connection(int Sock)
         * DNS and IDENT resolver subprocess using the "penalty" mechanism.
         * If there are results earlier, the delay is aborted. */
        Conn_SetPenalty(new_sock, 4);
+
+       NumConnections++;
+       LogDebug("Total number of connections now %ld.", NumConnections);
        return new_sock;
 } /* New_Connection */
 
@@ -1879,12 +1877,13 @@ Init_Socket( int Sock )
        }
 
        /* Set type of service (TOS) */
-#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
+#if defined(IPPROTO_IP) && defined(IPTOS_LOWDELAY)
        value = IPTOS_LOWDELAY;
-       LogDebug("Setting option IP_TOS on socket %d to IPTOS_LOWDELAY (%d).", Sock, value );
-       if( setsockopt( Sock, SOL_IP, IP_TOS, &value, (socklen_t)sizeof( value )) != 0 )
-       {
-               Log( LOG_ERR, "Can't set socket option IP_TOS: %s!", strerror( errno ));
+       LogDebug("Setting IP_TOS on socket %d to IPTOS_LOWDELAY.", Sock);
+       if (setsockopt(Sock, IPPROTO_IP, IP_TOS, &value,
+                      (socklen_t) sizeof(value))) {
+               Log(LOG_ERR, "Can't set socket option IP_TOS: %s!",
+                   strerror(errno));
                /* ignore this error */
        }
 #endif