commit - dd003e23b7763cf32416db35046d4bb6706ac56c
commit + e50d04907485e027afc466059f02a58ef1c586ac
blob - b63a89fbade8ecc17412cf54ffbe39e052f30131
blob + 4ff38ceec5e2e5b37d5442922e79ffcfeb1afbed
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
#include "portab.h"
#include "io.h"
-static char UNUSED id[] = "$Id: conn.c,v 1.158 2005/07/08 16:18:39 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.159 2005/07/09 21:35:20 fw Exp $";
#include "imp.h"
#include <assert.h>
#endif
io_close(sock);
return;
- }
+ }
if (what & IO_WANTREAD)
Read_Request( idx );
fd = (int*) array_get(&My_Listeners, sizeof (int), arraylen);
if (fd) {
close(*fd);
- Log( LOG_DEBUG, "Listening socket %d closed.", *fd );
#ifdef DEBUG
+ Log( LOG_DEBUG, "Listening socket %d closed.", *fd );
} else {
Log( LOG_DEBUG, "array_get pos %d returned NULL", arraylen );
#endif
close( sock );
return false;
}
- io_event_create( sock, IO_WANTREAD, cb_listen );
+ io_event_create( sock, IO_WANTREAD, cb_listen );
if( Conf_ListenAddress[0]) Log( LOG_INFO, "Now listening on %s:%d (socket %d).", Conf_ListenAddress, Port, sock );
else Log( LOG_INFO, "Now listening on 0.0.0.0:%d (socket %d).", Port, sock );
/* Socket der Verbindung in Set aufnehmen */
io_event_add( My_Connections[i].sock, IO_WANTWRITE );
}
-
}
/* von welchen Sockets koennte gelesen werden? */
if(( Client_Type( c ) != CLIENT_USER ) && ( Client_Type( c ) != CLIENT_SERVER ) &&
( Client_Type( c ) != CLIENT_SERVICE ) && ( bsize > ZREADBUFFER_LEN ))
bsize = ZREADBUFFER_LEN;
-#endif
-#ifdef ZLIB
if (( array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN ) ||
( array_bytes(&My_Connections[Idx].zip.rbuf) >= ZREADBUFFER_LEN ))
#else
#endif
result = false;
- do
- {
+ do {
/* Check penalty */
if( My_Connections[Idx].delaytime > time( NULL )) return result;
#ifdef ZLIB
LOCAL void
Check_Connections( void )
{
- /* Pruefen, ob Verbindungen noch "alive" sind. Ist dies
- * nicht der Fall, zunaechst PING-PONG spielen und, wenn
- * auch das nicht "hilft", Client disconnectieren. */
-
+ /* check if connections are alive. if not, play PING-PONG first.
+ * if this doesn't help either, disconnect client. */
CLIENT *c;
CONN_ID i;
- for( i = 0; i < Pool_Size; i++ )
- {
+ for( i = 0; i < Pool_Size; i++ ) {
if( My_Connections[i].sock == NONE ) continue;
c = Client_GetFromConn( i );
if( c && (( Client_Type( c ) == CLIENT_USER ) || ( Client_Type( c ) == CLIENT_SERVER ) || ( Client_Type( c ) == CLIENT_SERVICE )))
{
- /* verbundener User, Server oder Service */
- if( My_Connections[i].lastping > My_Connections[i].lastdata )
- {
- /* es wurde bereits ein PING gesendet */
- if( My_Connections[i].lastping < time( NULL ) - Conf_PongTimeout )
- {
+ /* connected User, Server or Service */
+ if( My_Connections[i].lastping > My_Connections[i].lastdata ) {
+ /* we already sent a ping */
+ if( My_Connections[i].lastping < time( NULL ) - Conf_PongTimeout ) {
/* Timeout */
#ifdef DEBUG
Log( LOG_DEBUG, "Connection %d: Ping timeout: %d seconds.", i, Conf_PongTimeout );
Conn_Close( i, NULL, "Ping timeout", true );
}
}
- else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout )
- {
- /* es muss ein PING gesendet werden */
+ else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout ) {
+ /* we need to sent a PING */
#ifdef DEBUG
Log( LOG_DEBUG, "Connection %d: sending PING ...", i );
#endif
}
else
{
- /* noch nicht vollstaendig aufgebaute Verbindung */
+ /* connection is not fully established yet */
if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout )
{
/* Timeout */