- if( FD_ISSET( My_Connections[Idx].sock, &My_Connects ))
- {
- /* es soll nichts geschrieben werden, sondern ein
- * connect() hat ein Ergebnis geliefert */
-
- FD_CLR( My_Connections[Idx].sock, &My_Connects );
-
- /* Ergebnis des connect() ermitteln */
- sock_len = sizeof( err );
- res = getsockopt( My_Connections[Idx].sock, SOL_SOCKET, SO_ERROR, &err, &sock_len );
- assert( sock_len == sizeof( err ));
-
- /* Fehler aufgetreten? */
- if(( res != 0 ) || ( err != 0 ))
- {
- /* Fehler! */
- if( res != 0 ) Log( LOG_CRIT, "getsockopt (connection %d): %s!", Idx, strerror( errno ));
- else Log( LOG_CRIT, "Can't connect socket to \"%s:%d\" (connection %d): %s!", My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port, Idx, strerror( err ));
-
- /* Clean up socket, connection and client structures */
- FD_CLR( My_Connections[Idx].sock, &My_Sockets );
- c = Client_GetFromConn( Idx );
- if( c ) Client_DestroyNow( c );
- close( My_Connections[Idx].sock );
- Init_Conn_Struct( Idx );
-
- /* Bei Server-Verbindungen lasttry-Zeitpunkt auf "jetzt" setzen */
- Conf_Server[Conf_GetServer( Idx )].lasttry = time( NULL );
- Conf_UnsetServer( Idx );
-
- return FALSE;
- }
- Log( LOG_INFO, "Connection %d with \"%s:%d\" established. Now logging in ...", Idx, My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port );
-
- /* Send PASS and SERVER command to peer */
- Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[Conf_GetServer( Idx )].pwd_out, NGIRCd_ProtoID );
- return Conn_WriteStr( Idx, "SERVER %s :%s", Conf_ServerName, Conf_ServerInfo );
- }
-
-#ifdef ZLIB
- /* Schreibpuffer leer, aber noch Daten im Kompressionsbuffer?
- * Dann muss dieser nun geflushed werden! */
- if( My_Connections[Idx].wdatalen == 0 ) Zip_Flush( Idx );
-#endif
-
- assert( My_Connections[Idx].wdatalen > 0 );
-
- /* Daten schreiben */
- len = send( My_Connections[Idx].sock, My_Connections[Idx].wbuf, My_Connections[Idx].wdatalen, 0 );
- if( len < 0 )
- {
- /* Operation haette Socket "nur" blockiert ... */
- if( errno == EAGAIN ) return TRUE;
-
- /* Oops, ein Fehler! */
- Log( LOG_ERR, "Write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror( errno ));
- Conn_Close( Idx, "Write error!", NULL, FALSE );
- return FALSE;