@@ -218,14 +218,16 @@ @selector(socket:didConnectToHost:port:)]) [_delegate socket: _socket didConnectToHost: _host port: _port]; } else { - if ([_delegate respondsToSelector: - @selector(stream:didFailWithException:)]) - [_delegate stream: _socket - didFailWithException: _exception]; + if ([_delegate respondsToSelector: @selector(socket: + didFailToConnectWithException:host:port:)]) + [_delegate socket: _socket + didFailToConnectWithException: _exception + host: _host + port: _port]; } #ifdef OF_HAVE_BLOCKS } #endif } @@ -552,12 +554,19 @@ assert(0); return 0; } } -- (void)stream: (OF_KINDOF(OFStream *))sock - didFailWithException: (id)exception +- (void)stream: (OF_KINDOF(OFStream *))sock + didFailToReadWithException: (id)exception +{ + _exception = [exception retain]; + [self didConnect]; +} + +- (void)stream: (OF_KINDOF(OFStream *))sock + didFailToWriteWithException: (id)exception { _exception = [exception retain]; [self didConnect]; } @end @@ -575,12 +584,12 @@ port: (uint16_t)port { _done = true; } -- (void)stream: (OF_KINDOF(OFStream *))stream - didFailWithException: (id)exception +- (void)socket: (OF_KINDOF(OFTCPSocket *))sock + didFailToConnectWithException: (id)exception { _done = true; _exception = [exception retain]; } @end