commit bb98fd8c85fa3292b95134d727864c090c29d783 from: Alexander Barton date: Sun Jan 25 16:06:34 2004 UTC The type of service (TOS) of all sockets is set to "interactive" now. commit - e9b0ec9148ac8579eca9c4c387a6daa1a1c94b98 commit + bb98fd8c85fa3292b95134d727864c090c29d783 blob - 793c22ae1289ca565b32226588e95a68cb12ac51 blob + aa2feea0507fd05238edceeb1be5a6a4a58ef150 --- ChangeLog +++ 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 $ blob - a7fa785f3651e505974e7d65a60a3e37cc1789a4 blob + b6afc1f4265ba96f2f3ec880a811088c47d706fc --- NEWS +++ 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 $ blob - 7b9dcdb3c0a053a43b6c7be7396e225f326b1473 blob + 351a245990615b7b761903c77d24f537a1f73325 --- src/ngircd/conn.c +++ src/ngircd/conn.c @@ -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 @@ -33,18 +33,22 @@ static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12 #include #include +#ifdef HAVE_NETINET_IP_H +# include +#endif + #ifdef HAVE_ARPA_INET_H -#include +# include #else -#define PF_INET AF_INET +# define PF_INET AF_INET #endif #ifdef HAVE_STDINT_H -#include /* e.g. for Mac OS X */ +# include /* e.g. for Mac OS X */ #endif #ifdef TCPWRAP -#include /* for TCP Wrappers */ +# include /* for TCP Wrappers */ #endif #include "defines.h" @@ -64,7 +68,7 @@ static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12 #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 */