@@ -62,11 +62,12 @@ static of_run_loop_mode_t connectRunLoopMode = @"of_tcp_socket_connect_mode"; static OFString *defaultSOCKS5Host = nil; static uint16_t defaultSOCKS5Port = 1080; -@interface OFTCPSocket_AsyncConnectContext: OFObject +@interface OFTCPSocket_AsyncConnectContext: OFObject { OFTCPSocket *_socket; OFString *_host; uint16_t _port; OFString *_SOCKS5Host; @@ -104,12 +105,10 @@ SOCKS5Host: (OFString *)SOCKS5Host SOCKS5Port: (uint16_t)SOCKS5Port block: (of_tcp_socket_async_connect_block_t)block; #endif - (void)didConnect; -- (void)socketDidConnect: (OFTCPSocket *)sock - exception: (id)exception; - (void)tryNextAddressWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; - (void)resolver: (OFDNSResolver *)resolver didResolveDomainName: (OFString *)domainName socketAddresses: (OFData *)socketAddresses context: (id)context @@ -230,12 +229,12 @@ #ifdef OF_HAVE_BLOCKS } #endif } -- (void)socketDidConnect: (OFTCPSocket *)sock - exception: (id)exception +- (void)of_socketDidConnect: (OF_KINDOF(OFTCPSocket *))sock + exception: (id)exception { if (exception != nil) { if (_socketAddressesIndex >= [_socketAddresses count]) { _exception = [exception retain]; [self didConnect]; @@ -283,16 +282,13 @@ [_socket setBlocking: false]; if (![_socket of_connectSocketToAddress: &address errNo: &errNo]) { if (errNo == EINPROGRESS) { - SEL selector = @selector(socketDidConnect:exception:); - [OFRunLoop of_addAsyncConnectForTCPSocket: _socket mode: runLoopMode - target: self - selector: selector]; + delegate: self]; return; } else { [_socket of_closeSocket]; if (_socketAddressesIndex >= [_socketAddresses count]) {