52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
id _target;
SEL _selector;
id _context;
# ifdef OF_HAVE_BLOCKS
of_udp_socket_async_resolve_block_t _block;
# endif
of_udp_socket_address_t _address;
OFException *_exception;
}
- initWithSourceThread: (OFThread *)sourceThread
host: (OFString *)host
port: (uint16_t)port
target: (id)target
selector: (SEL)selector
|
|
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
id _target;
SEL _selector;
id _context;
# ifdef OF_HAVE_BLOCKS
of_udp_socket_async_resolve_block_t _block;
# endif
of_udp_socket_address_t _address;
id _exception;
}
- initWithSourceThread: (OFThread *)sourceThread
host: (OFString *)host
port: (uint16_t)port
target: (id)target
selector: (SEL)selector
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# ifdef OF_HAVE_BLOCKS
if (_block != NULL)
_block(_host, _port, _address, _exception);
else {
# endif
void (*func)(id, SEL, OFString *, uint16_t,
of_udp_socket_address_t, id, OFException *) =
(void (*)(id, SEL, OFString *, uint16_t,
of_udp_socket_address_t, id, OFException *))
[_target methodForSelector: _selector];
func(_target, _selector, _host, _port, _address, _context,
_exception);
# ifdef OF_HAVE_BLOCKS
}
# endif
}
- (id)main
{
void *pool = objc_autoreleasePoolPush();
@try {
[OFUDPSocket resolveAddressForHost: _host
port: _port
address: &_address];
} @catch (OFException *e) {
_exception = e;
}
[self performSelector: @selector(didResolve)
onThread: _sourceThread
waitUntilDone: false];
|
|
|
|
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# ifdef OF_HAVE_BLOCKS
if (_block != NULL)
_block(_host, _port, _address, _exception);
else {
# endif
void (*func)(id, SEL, OFString *, uint16_t,
of_udp_socket_address_t, id, id) =
(void (*)(id, SEL, OFString *, uint16_t,
of_udp_socket_address_t, id, id))
[_target methodForSelector: _selector];
func(_target, _selector, _host, _port, _address, _context,
_exception);
# ifdef OF_HAVE_BLOCKS
}
# endif
}
- (id)main
{
void *pool = objc_autoreleasePoolPush();
@try {
[OFUDPSocket resolveAddressForHost: _host
port: _port
address: &_address];
} @catch (id e) {
_exception = e;
}
[self performSelector: @selector(didResolve)
onThread: _sourceThread
waitUntilDone: false];
|