Differences From Artifact [f42e23d703]:
- File src/OFTCPSocket.m — part of check-in [3dec8ecf2e] at 2019-08-09 23:44:51 on branch trunk — Support sockets on AmigaOS 3 (user: js, size: 26064) [annotate] [blame] [check-ins using]
To Artifact [5389356633]:
- File
src/OFTCPSocket.m
— part of check-in
[e3c911c7f5]
at
2019-10-07 20:32:09
on branch trunk
— Split OFDNSResolverDelegate into two delegates
These are different enough that it makes no sense to have them in one.
Having them in one means all methods are @optional and typos cannot be
caught by the compiler. (user: js, size: 26024) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
63 64 65 66 67 68 69 | Class of_tls_socket_class = Nil; static OFString *defaultSOCKS5Host = nil; static uint16_t defaultSOCKS5Port = 1080; @interface OFTCPSocketAsyncConnectDelegate: OFObject <OFTCPSocketDelegate, | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | Class of_tls_socket_class = Nil; static OFString *defaultSOCKS5Host = nil; static uint16_t defaultSOCKS5Port = 1080; @interface OFTCPSocketAsyncConnectDelegate: OFObject <OFTCPSocketDelegate, OFTCPSocketDelegate_Private, OFDNSResolverHostDelegate> { OFTCPSocket *_socket; OFString *_host; uint16_t _port; OFString *_SOCKS5Host; uint16_t _SOCKS5Port; id <OFTCPSocketDelegate> _delegate; |
︙ | ︙ | |||
317 318 319 320 321 322 323 | #if defined(OF_NINTENDO_3DS) || defined(OF_WII) _socket.blocking = false; #endif [self didConnect]; } | | | | | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | #if defined(OF_NINTENDO_3DS) || defined(OF_WII) _socket.blocking = false; #endif [self didConnect]; } - (void)resolver: (OFDNSResolver *)resolver didResolveHost: (OFString *)host addresses: (OFData *)addresses exception: (id)exception { if (exception != nil) { _exception = [exception retain]; [self didConnect]; return; } _socketAddresses = [addresses copy]; [self tryNextAddressWithRunLoopMode: [OFRunLoop currentRunLoop].currentMode]; } - (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode { |
︙ | ︙ | |||
365 366 367 368 369 370 371 | [self tryNextAddressWithRunLoopMode: runLoopMode]; return; } @catch (OFInvalidFormatException *e) { } [[OFThread DNSResolver] | | | | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | [self tryNextAddressWithRunLoopMode: runLoopMode]; return; } @catch (OFInvalidFormatException *e) { } [[OFThread DNSResolver] asyncResolveAddressesForHost: host addressFamily: OF_SOCKET_ADDRESS_FAMILY_ANY runLoopMode: runLoopMode delegate: self]; } - (void)sendSOCKS5Request { OFData *data = [OFData dataWithItems: "\x05\x01\x00" count: 3]; |
︙ | ︙ | |||
808 809 810 811 812 813 814 | @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if (_SOCKS5Host != nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; socketAddresses = [[OFThread DNSResolver] | | | | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if (_SOCKS5Host != nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; socketAddresses = [[OFThread DNSResolver] resolveAddressesForHost: host addressFamily: OF_SOCKET_ADDRESS_FAMILY_ANY]; address = *(of_socket_address_t *)[socketAddresses itemAtIndex: 0]; of_socket_address_set_port(&address, port); if ((_socket = socket(address.sockaddr.sockaddr.sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == INVALID_SOCKET) @throw [OFBindFailedException |
︙ | ︙ |