X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=dccdb6a606cae7186a090345262b9f153a825344;hp=c14b7504139755fa2cf482380d64069af1112ce5;hb=c0a571400262b736edff2cd2c9fd288dcf00e284;hpb=65bdfdf26f59086d9b4104df7198d6fe02df47bd diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index c14b7504..dccdb6a6 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -9,11 +9,26 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: conn.c,v 1.12 2001/12/26 03:20:53 alex Exp $ + * $Id: conn.c,v 1.17 2001/12/29 03:06:16 alex Exp $ * * connect.h: Verwaltung aller Netz-Verbindungen ("connections") * * $Log: conn.c,v $ + * Revision 1.17 2001/12/29 03:06:16 alex + * - Loglevel (nochmal) angepasst. + * + * Revision 1.16 2001/12/27 19:32:44 alex + * - bei "Null-Requests" wird nichts mehr geloggt. Uberfluessig, da normal. + * + * Revision 1.15 2001/12/27 16:35:04 alex + * - vergessene Variable bei Ping-Timeout-Logmeldung ergaenzt. Opsa. + * + * Revision 1.14 2001/12/26 14:45:37 alex + * - "Code Cleanups". + * + * Revision 1.13 2001/12/26 03:36:57 alex + * - Verbindungen mit Lesefehlern werden nun korrekt terminiert. + * * Revision 1.12 2001/12/26 03:20:53 alex * - PING/PONG-Timeout implementiert. * @@ -75,6 +90,7 @@ #include #include #include +#include #include #include @@ -177,7 +193,7 @@ GLOBAL VOID Conn_Exit( VOID ) } /* Conn_Exit */ -GLOBAL BOOLEAN Conn_New_Listener( CONST INT Port ) +GLOBAL BOOLEAN Conn_NewListener( CONST INT Port ) { /* Neuen Listen-Socket erzeugen: der Server wartet dann * auf dem angegebenen Port auf Verbindungen. */ @@ -237,7 +253,7 @@ GLOBAL BOOLEAN Conn_New_Listener( CONST INT Port ) Log( LOG_INFO, "Now listening on port %d, socket %d.", Port, sock ); return TRUE; -} /* Conn_New_Listener */ +} /* Conn_NewListener */ GLOBAL VOID Conn_Handler( INT Timeout ) @@ -506,7 +522,7 @@ LOCAL VOID New_Connection( INT Sock ) } /* Client-Struktur initialisieren */ - if( ! Client_New_Local( idx, inet_ntoa( new_addr.sin_addr ))) + if( ! Client_NewLocal( idx, inet_ntoa( new_addr.sin_addr ))) { Log( LOG_ALERT, "Can't accept connection: can't create client structure!" ); close( new_sock ); @@ -570,7 +586,7 @@ LOCAL VOID Read_Request( CONN_ID Idx ) { /* Fehler beim Lesen */ Log( LOG_ALERT, "Read error on connection %d: %s!", Idx, strerror( errno )); - Conn_Close( Idx, "Read error!" ); + Conn_Close( Idx, NULL ); return; } @@ -628,7 +644,6 @@ LOCAL VOID Handle_Buffer( CONN_ID Idx ) /* Es wurde ein Request gelesen */ if( ! Parse_Request( Idx, My_Connections[Idx].rbuf )) return; } - else Log( LOG_DEBUG, "Got null-request (connection %d).", Idx ); /* Puffer anpassen */ My_Connections[Idx].rdatalen -= len; @@ -650,14 +665,14 @@ LOCAL VOID Check_Connections( VOID ) if( My_Connections[i].lastping > My_Connections[i].lastdata ) { /* es wurde bereits ein PING gesendet */ - if( My_Connections[i].lastping < time( NULL ) - Conf_PONG_Timeout ) + if( My_Connections[i].lastping < time( NULL ) - Conf_PongTimeout ) { /* Timeout */ - Log( LOG_NOTICE, "Connection %d: Ping timeout." ); + Log( LOG_INFO, "Connection %d: Ping timeout.", i ); Conn_Close( i, "Ping timeout" ); } } - else if( My_Connections[i].lastdata < time( NULL ) - Conf_PING_Timeout ) + else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout ) { /* es muss ein PING gesendet werden */ Log( LOG_DEBUG, "Connection %d: sending PING ...", i );