65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
[super dealloc];
}
- (void)didConnect
{
if (_exception == nil)
[_socket setBlocking: true];
#ifdef OF_HAVE_BLOCKS
if (_block != NULL) {
if ([_socket isKindOfClass: [OFTCPSocket class]])
((of_tcp_socket_async_connect_block_t)_block)(
_exception);
# ifdef OF_HAVE_SCTP
|
|
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
[super dealloc];
}
- (void)didConnect
{
if (_exception == nil)
[_socket setCanBlock: true];
#ifdef OF_HAVE_BLOCKS
if (_block != NULL) {
if ([_socket isKindOfClass: [OFTCPSocket class]])
((of_tcp_socket_async_connect_block_t)_block)(
_exception);
# ifdef OF_HAVE_SCTP
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
* Additionally, on Wii, there is no getsockopt(), so it would not be
* possible to get the error (or success) after connecting anyway.
*
* So for now, connecting is blocking on Wii and 3DS.
*
* FIXME: Use a different thread as a work around.
*/
[_socket setBlocking: true];
#else
[_socket setBlocking: false];
#endif
if (![_socket of_connectSocketToAddress: &address
errNo: &errNo]) {
#if !defined(OF_NINTENDO_3DS) && !defined(OF_WII)
if (errNo == EINPROGRESS) {
[OFRunLoop of_addAsyncConnectForSocket: _socket
|
|
|
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
* Additionally, on Wii, there is no getsockopt(), so it would not be
* possible to get the error (or success) after connecting anyway.
*
* So for now, connecting is blocking on Wii and 3DS.
*
* FIXME: Use a different thread as a work around.
*/
[_socket setCanBlock: true];
#else
[_socket setCanBlock: false];
#endif
if (![_socket of_connectSocketToAddress: &address
errNo: &errNo]) {
#if !defined(OF_NINTENDO_3DS) && !defined(OF_WII)
if (errNo == EINPROGRESS) {
[OFRunLoop of_addAsyncConnectForSocket: _socket
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
return;
#if !defined(OF_NINTENDO_3DS) && !defined(OF_WII)
}
#endif
}
#if defined(OF_NINTENDO_3DS) || defined(OF_WII)
[_socket setBlocking: false];
#endif
[self didConnect];
}
- (void)resolver: (OFDNSResolver *)resolver
didResolveHost: (OFString *)host
|
|
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
return;
#if !defined(OF_NINTENDO_3DS) && !defined(OF_WII)
}
#endif
}
#if defined(OF_NINTENDO_3DS) || defined(OF_WII)
[_socket setCanBlock: false];
#endif
[self didConnect];
}
- (void)resolver: (OFDNSResolver *)resolver
didResolveHost: (OFString *)host
|