]> arthur.barton.de Git - ngircd-alex.git/commitdiff
The type of service (TOS) of all sockets is set to "interactive" now.
authorAlexander Barton <alex@barton.de>
Sun, 25 Jan 2004 16:06:34 +0000 (16:06 +0000)
committerAlexander Barton <alex@barton.de>
Sun, 25 Jan 2004 16:06:34 +0000 (16:06 +0000)
ChangeLog
NEWS
src/ngircd/conn.c

index 793c22ae1289ca565b32226588e95a68cb12ac51..aa2feea0507fd05238edceeb1be5a6a4a58ef150 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
 
 ngIRCd CVSHEAD
 
+  - The type of service (TOS) of all sockets is set to "interactive" now.
   - Added short command line option "-t" as alternative to "--configtest".
   - Added optional support for "IDENT" lookups on incoming connections. You
     have to enable this function with the ./configure switch "--with-ident".
@@ -492,4 +493,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: ChangeLog,v 1.221 2003/12/29 14:53:26 alex Exp $
+$Id: ChangeLog,v 1.222 2004/01/25 16:06:35 alex Exp $
diff --git a/NEWS b/NEWS
index a7fa785f3651e505974e7d65a60a3e37cc1789a4..b6afc1f4265ba96f2f3ec880a811088c47d706fc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@
 
 ngIRCd CVSHEAD
 
+  - The type of service (TOS) of all sockets is set to "interactive" now.
+  - Added short command line option "-t" as alternative to "--configtest".
   - Added optional support for "IDENT" lookups on incoming connections. You
     have to enable this function with the ./configure switch "--with-ident".
     The default is not to do IDENT lookups.
@@ -180,4 +182,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: NEWS,v 1.61 2003/12/27 13:01:12 alex Exp $
+$Id: NEWS,v 1.62 2004/01/25 16:06:34 alex Exp $
index 7b9dcdb3c0a053a43b6c7be7396e225f326b1473..351a245990615b7b761903c77d24f537a1f73325 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2004 by Alexander Barton (alex@barton.de)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12/27 13:01:12 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.130 2004/01/25 16:06:35 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -33,18 +33,22 @@ static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12/27 13:01:12 alex Exp $";
 #include <time.h>
 #include <netinet/in.h>
 
+#ifdef HAVE_NETINET_IP_H
+# include <netinet/ip.h>
+#endif
+
 #ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
+# include <arpa/inet.h>
 #else
-#define PF_INET AF_INET
+# define PF_INET AF_INET
 #endif
 
 #ifdef HAVE_STDINT_H
-#include <stdint.h>                    /* e.g. for Mac OS X */
+# include <stdint.h>                   /* e.g. for Mac OS X */
 #endif
 
 #ifdef TCPWRAP
-#include <tcpd.h>                      /* for TCP Wrappers */
+# include <tcpd.h>                     /* for TCP Wrappers */
 #endif
 
 #include "defines.h"
@@ -64,7 +68,7 @@ static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12/27 13:01:12 alex Exp $";
 #include "tool.h"
 
 #ifdef RENDEZVOUS
-#include "rendezvous.h"
+# include "rendezvous.h"
 #endif
 
 #include "exp.h"
@@ -1549,24 +1553,40 @@ Init_Conn_Struct( CONN_ID Idx )
 LOCAL BOOLEAN
 Init_Socket( INT Sock )
 {
-       /* Socket-Optionen setzen */
+       /* Initialize socket (set options) */
 
-       INT on = 1;
+       INT value;
 
-#ifdef O_NONBLOCK      /* A/UX kennt das nicht? */
+#ifdef O_NONBLOCK      /* unknown on A/UX */
        if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 )
        {
-               Log( LOG_CRIT, "Can't enable non-blocking mode: %s!", strerror( errno ));
+               Log( LOG_CRIT, "Can't enable non-blocking mode for socket: %s!", strerror( errno ));
                close( Sock );
                return FALSE;
        }
 #endif
-       if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &on, (socklen_t)sizeof( on )) != 0)
+
+       /* Don't block this port after socket shutdown */
+       value = 1;
+       if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &value, (socklen_t)sizeof( value )) != 0 )
        {
-               Log( LOG_ERR, "Can't set socket options: %s!", strerror( errno ));
-               /* dieser Fehler kann ignoriert werden. */
+               Log( LOG_ERR, "Can't set socket option SO_REUSEADDR: %s!", strerror( errno ));
+               /* ignore this error */
        }
 
+       /* Set type of service (TOS) */
+#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
+       value = IPTOS_LOWDELAY;
+#ifdef DEBUG
+       Log( LOG_DEBUG, "Setting option IP_TOS on socket %d to IPTOS_LOWDELAY (%d).", Sock, value );
+#endif
+       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 ));
+               /* ignore this error */
+       }
+#endif
+
        return TRUE;
 } /* Init_Socket */