Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -145,40 +145,26 @@ } - (void)socket: (OF_KINDOF(OFTCPSocket *))sock didConnectToHost: (OFString *)host port: (uint16_t)port -{ - @try { - [sock SSL_startTLSWithExpectedHost: _host - port: _port]; - } @catch (id e) { - [_socket setDelegate: _delegate]; - [_delegate socket: sock - didFailToConnectWithException: e - host: host - port: port]; - return; + exception: (id)exception +{ + if (exception == nil) { + @try { + [sock SSL_startTLSWithExpectedHost: _host + port: _port]; + } @catch (id e) { + exception = e; + } } [_socket setDelegate: _delegate]; [_delegate socket: sock didConnectToHost: host - port: port]; -} - -- (void)socket: (OF_KINDOF(OFTCPSocket *))sock - didFailToConnectWithException: (id)exception - host: (OFString *)host - port: (uint16_t)port -{ - [_socket setDelegate: _delegate]; - - return [_delegate socket: sock - didFailToConnectWithException: exception - host: host - port: port]; + port: port + exception: exception]; } @end @implementation SSLSocket @dynamic delegate;