- assert( My_Connections[Idx].sock > NONE );
-
- c = Client_GetFromConn( Idx );
-
- if( InformClient )
- {
- /* Statistik an Client melden, wenn User */
- if(( c != NULL ) && ( Client_Type( c ) == CLIENT_USER ))
- {
- Conn_WriteStr( Idx, "NOTICE %s :%sConnection statistics: client %.1f kb, server %.1f kb.", Client_ThisServer( ), NOTICE_TXTPREFIX, (DOUBLE)My_Connections[Idx].bytes_in / 1024, (DOUBLE)My_Connections[Idx].bytes_out / 1024 );
- }
-
- /* ERROR an Client schicken (von RFC so vorgesehen!) */
- if( FwdMsg ) Conn_WriteStr( Idx, "ERROR :%s", FwdMsg );
- else Conn_WriteStr( Idx, "ERROR :Closing connection." );
- if( My_Connections[Idx].sock == NONE ) return;
- }
-
- if( close( My_Connections[Idx].sock ) != 0 )
- {
- Log( LOG_ERR, "Error closing connection %d (socket %d) with %s:%d - %s!", Idx, My_Connections[Idx].sock, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port), strerror( errno ));
- }
- else
- {
- in_k = (DOUBLE)My_Connections[Idx].bytes_in / 1024;
- out_k = (DOUBLE)My_Connections[Idx].bytes_out / 1024;
-#ifdef USE_ZLIB
- if( My_Connections[Idx].options & CONN_ZIP )
- {
- in_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_in / 1024;
- out_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_out / 1024;
- in_p = (INT)(( in_k * 100 ) / in_z_k );
- out_p = (INT)(( out_k * 100 ) / out_z_k );
- Log( LOG_INFO, "Connection %d (socket %d) with %s:%d closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).", Idx, My_Connections[Idx].sock, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, in_z_k, in_p, out_k, out_z_k, out_p );
- }
- else
-#endif
- {
- Log( LOG_INFO, "Connection %d (socket %d) with %s:%d closed (in: %.1fk, out: %.1fk).", Idx, My_Connections[Idx].sock, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, out_k );
- }
- }
-
- /* Socket als "ungueltig" markieren */
- FD_CLR( My_Connections[Idx].sock, &My_Sockets );
- FD_CLR( My_Connections[Idx].sock, &My_Connects );
- My_Connections[Idx].sock = NONE;
-
- if( c ) Client_Destroy( c, LogMsg, FwdMsg, TRUE );
-
- if( My_Connections[Idx].res_stat )
- {
- /* Resolver-Strukturen freigeben, wenn noch nicht geschehen */
- FD_CLR( My_Connections[Idx].res_stat->pipe[0], &Resolver_FDs );
- close( My_Connections[Idx].res_stat->pipe[0] );
- close( My_Connections[Idx].res_stat->pipe[1] );
- free( My_Connections[Idx].res_stat );
- }
-
- /* Startzeit des naechsten Connect-Versuchs modifizieren? */
- if(( My_Connections[Idx].our_server > NONE ) && ( Conf_Server[My_Connections[Idx].our_server].lasttry < time( NULL ) - Conf_ConnectRetry ))
- {
- /* Okay, die Verbindung stand schon "genuegend lange":
- * lasttry-Zeitpunkt so setzen, dass der naechste
- * Verbindungsversuch in RECONNECT_DELAY Sekunden
- * gestartet wird. */
- Conf_Server[My_Connections[Idx].our_server].lasttry = time( NULL ) - Conf_ConnectRetry + RECONNECT_DELAY;
- }