- if ( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_ISCONNECTING )) {
- /* connect() has finished, check result */
-
- Conn_OPTION_DEL( &My_Connections[Idx], CONN_ISCONNECTING );
-
- /* 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 );
- }