47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
@interface OFSPXSocketAsyncConnectDelegate: OFObject <OFRunLoopConnectDelegate>
{
OFSPXSocket *_socket;
unsigned char _node[IPX_NODE_LEN];
uint32_t _network;
uint16_t _port;
#ifdef OF_HAVE_BLOCKS
of_spx_socket_async_connect_block_t _block;
#endif
}
- (instancetype)initWithSocket: (OFSPXSocket *)socket
node: (unsigned char [IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
#ifdef OF_HAVE_BLOCKS
block: (of_spx_socket_async_connect_block_t)block
#endif
;
- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode;
@end
@implementation OFSPXSocketAsyncConnectDelegate
- (instancetype)initWithSocket: (OFSPXSocket *)sock
node: (unsigned char [IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
#ifdef OF_HAVE_BLOCKS
block: (of_spx_socket_async_connect_block_t)block
#endif
{
self = [super init];
@try {
_socket = [sock retain];
memcpy(_node, node, IPX_NODE_LEN);
|
|
|
|
|
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
@interface OFSPXSocketAsyncConnectDelegate: OFObject <OFRunLoopConnectDelegate>
{
OFSPXSocket *_socket;
unsigned char _node[IPX_NODE_LEN];
uint32_t _network;
uint16_t _port;
#ifdef OF_HAVE_BLOCKS
OFSPXSocketAsyncConnectBlock _block;
#endif
}
- (instancetype)initWithSocket: (OFSPXSocket *)socket
node: (unsigned char [IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
#ifdef OF_HAVE_BLOCKS
block: (OFSPXSocketAsyncConnectBlock)block
#endif
;
- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode;
@end
@implementation OFSPXSocketAsyncConnectDelegate
- (instancetype)initWithSocket: (OFSPXSocket *)sock
node: (unsigned char [IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
#ifdef OF_HAVE_BLOCKS
block: (OFSPXSocketAsyncConnectBlock)block
#endif
{
self = [super init];
@try {
_socket = [sock retain];
memcpy(_node, node, IPX_NODE_LEN);
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#ifdef OF_HAVE_BLOCKS
[_block release];
#endif
[super dealloc];
}
- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode
{
of_socket_address_t address =
of_socket_address_ipx(_node, _network, _port);
id exception = nil;
int errNo;
if (![_socket of_createSocketForAddress: &address errNo: &errNo]) {
|
|
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#ifdef OF_HAVE_BLOCKS
[_block release];
#endif
[super dealloc];
}
- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode
{
of_socket_address_t address =
of_socket_address_ipx(_node, _network, _port);
id exception = nil;
int errNo;
if (![_socket of_createSocketForAddress: &address errNo: &errNo]) {
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
{
[self asyncConnectToNode: node
network: network
port: port
runLoopMode: of_run_loop_mode_default];
}
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
void *pool = objc_autoreleasePoolPush();
[[[[OFSPXSocketAsyncConnectDelegate alloc]
initWithSocket: self
node: node
network: network
port: port
#ifdef OF_HAVE_BLOCKS
block: NULL
#endif
] autorelease] startWithRunLoopMode: runLoopMode];
objc_autoreleasePoolPop(pool);
}
#ifdef OF_HAVE_BLOCKS
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
block: (of_spx_socket_async_connect_block_t)block
{
[self asyncConnectToNode: node
network: network
port: port
runLoopMode: of_run_loop_mode_default
block: block];
}
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
runLoopMode: (of_run_loop_mode_t)runLoopMode
block: (of_spx_socket_async_connect_block_t)block
{
void *pool = objc_autoreleasePoolPush();
[[[[OFSPXSocketAsyncConnectDelegate alloc]
initWithSocket: self
node: node
network: network
|
|
|
|
|
|
|
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
{
[self asyncConnectToNode: node
network: network
port: port
runLoopMode: OFDefaultRunLoopMode];
}
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
runLoopMode: (OFRunLoopMode)runLoopMode
{
void *pool = objc_autoreleasePoolPush();
[[[[OFSPXSocketAsyncConnectDelegate alloc]
initWithSocket: self
node: node
network: network
port: port
#ifdef OF_HAVE_BLOCKS
block: NULL
#endif
] autorelease] startWithRunLoopMode: runLoopMode];
objc_autoreleasePoolPop(pool);
}
#ifdef OF_HAVE_BLOCKS
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
block: (OFSPXSocketAsyncConnectBlock)block
{
[self asyncConnectToNode: node
network: network
port: port
runLoopMode: OFDefaultRunLoopMode
block: block];
}
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
network: (uint32_t)network
port: (uint16_t)port
runLoopMode: (OFRunLoopMode)runLoopMode
block: (OFSPXSocketAsyncConnectBlock)block
{
void *pool = objc_autoreleasePoolPush();
[[[[OFSPXSocketAsyncConnectDelegate alloc]
initWithSocket: self
node: node
network: network
|