Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -220,17 +220,18 @@ - (void)of_socketDidConnect: (OFTCPSocket *)sock exception: (id)exception { if (exception != nil) { + [sock of_closeSocket]; + if (_socketAddressesIndex >= _socketAddresses.count) { _exception = [exception retain]; [self didConnect]; - } else { + } else [self tryNextAddressWithRunLoopMode: [OFRunLoop currentRunLoop].currentMode]; - } return; } if (_SOCKS5Host != nil)