128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
{
void *pool = objc_autoreleasePoolPush();
id <OFSCTPSocketDelegate> delegate = _delegate;
OFSCTPSocketConnectDelegate *connectDelegate =
[[[OFSCTPSocketConnectDelegate alloc] init] autorelease];
OFRunLoop *runLoop = [OFRunLoop currentRunLoop];
self.delegate = connectDelegate;
[self asyncConnectToHost: host
port: port
runLoopMode: connectRunLoopMode];
while (!connectDelegate->_done)
[runLoop runMode: connectRunLoopMode beforeDate: nil];
/* Cleanup */
[runLoop runMode: connectRunLoopMode beforeDate: [OFDate date]];
if (connectDelegate->_exception != nil)
@throw connectDelegate->_exception;
self.delegate = delegate;
objc_autoreleasePoolPop(pool);
}
- (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port
{
[self asyncConnectToHost: host
|
|
|
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
{
void *pool = objc_autoreleasePoolPush();
id <OFSCTPSocketDelegate> delegate = _delegate;
OFSCTPSocketConnectDelegate *connectDelegate =
[[[OFSCTPSocketConnectDelegate alloc] init] autorelease];
OFRunLoop *runLoop = [OFRunLoop currentRunLoop];
_delegate = connectDelegate;
[self asyncConnectToHost: host
port: port
runLoopMode: connectRunLoopMode];
while (!connectDelegate->_done)
[runLoop runMode: connectRunLoopMode beforeDate: nil];
/* Cleanup */
[runLoop runMode: connectRunLoopMode beforeDate: [OFDate date]];
if (connectDelegate->_exception != nil)
@throw connectDelegate->_exception;
_delegate = delegate;
objc_autoreleasePoolPop(pool);
}
- (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port
{
[self asyncConnectToHost: host
|