93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
port: (uint16_t)port
block: (of_tcp_socket_async_connect_block_t)block;
# endif
@end
@implementation OFTCPSocket_ConnectThread
- initWithSourceThread: (OFThread *)sourceThread
socket: (OFTCPSocket *)socket
host: (OFString *)host
port: (uint16_t)port
target: (id)target
selector: (SEL)selector
{
self = [super init];
@try {
_sourceThread = [sourceThread retain];
_socket = [socket retain];
_host = [host copy];
_port = port;
_target = [target retain];
_selector = selector;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
# ifdef OF_HAVE_BLOCKS
- initWithSourceThread: (OFThread *)sourceThread
socket: (OFTCPSocket *)socket
host: (OFString *)host
port: (uint16_t)port
block: (of_tcp_socket_async_connect_block_t)block
{
self = [super init];
@try {
_sourceThread = [sourceThread retain];
_socket = [socket retain];
_host = [host copy];
_port = port;
_block = [block copy];
} @catch (id e) {
[self release];
@throw e;
}
|
|
|
|
|
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
port: (uint16_t)port
block: (of_tcp_socket_async_connect_block_t)block;
# endif
@end
@implementation OFTCPSocket_ConnectThread
- initWithSourceThread: (OFThread *)sourceThread
socket: (OFTCPSocket *)sock
host: (OFString *)host
port: (uint16_t)port
target: (id)target
selector: (SEL)selector
{
self = [super init];
@try {
_sourceThread = [sourceThread retain];
_socket = [sock retain];
_host = [host copy];
_port = port;
_target = [target retain];
_selector = selector;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
# ifdef OF_HAVE_BLOCKS
- initWithSourceThread: (OFThread *)sourceThread
socket: (OFTCPSocket *)sock
host: (OFString *)host
port: (uint16_t)port
block: (of_tcp_socket_async_connect_block_t)block
{
self = [super init];
@try {
_sourceThread = [sourceThread retain];
_socket = [sock retain];
_host = [host copy];
_port = port;
_block = [block copy];
} @catch (id e) {
[self release];
@throw e;
}
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
{
void *pool = objc_autoreleasePoolPush();
@try {
[_socket connectToHost: _host
port: _port];
} @catch (OFException *e) {
_exception = e;
}
[self performSelector: @selector(didConnect)
onThread: _sourceThread
waitUntilDone: false];
objc_autoreleasePoolPop(pool);
|
|
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
{
void *pool = objc_autoreleasePoolPush();
@try {
[_socket connectToHost: _host
port: _port];
} @catch (OFException *e) {
_exception = [e retain];
}
[self performSelector: @selector(didConnect)
onThread: _sourceThread
waitUntilDone: false];
objc_autoreleasePoolPop(pool);
|