47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFSetOptionFailedException.h"
#import "socket.h"
#import "socket_helpers.h"
static const of_run_loop_mode_t connectRunLoopMode =
@"of_tcp_socket_connect_mode";
Class of_tls_socket_class = Nil;
static OFString *defaultSOCKS5Host = nil;
static uint16_t defaultSOCKS5Port = 1080;
@interface OFTCPSocket () <OFIPSocketAsyncConnecting>
|
|
|
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFSetOptionFailedException.h"
#import "socket.h"
#import "socket_helpers.h"
static const OFRunLoopMode connectRunLoopMode =
@"OFTCPSocketConnectRunLoopMode";
Class of_tls_socket_class = Nil;
static OFString *defaultSOCKS5Host = nil;
static uint16_t defaultSOCKS5Port = 1080;
@interface OFTCPSocket () <OFIPSocketAsyncConnecting>
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
objc_autoreleasePoolPop(pool);
}
- (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port
{
[self asyncConnectToHost: host
port: port
runLoopMode: of_run_loop_mode_default];
}
- (void)asyncConnectToHost: (OFString *)host
port: (uint16_t)port
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
void *pool = objc_autoreleasePoolPush();
id <OFTCPSocketDelegate> delegate;
if (_socket != INVALID_SOCKET)
@throw [OFAlreadyConnectedException exceptionWithSocket: self];
|
|
|
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
objc_autoreleasePoolPop(pool);
}
- (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port
{
[self asyncConnectToHost: host
port: port
runLoopMode: OFDefaultRunLoopMode];
}
- (void)asyncConnectToHost: (OFString *)host
port: (uint16_t)port
runLoopMode: (OFRunLoopMode)runLoopMode
{
void *pool = objc_autoreleasePoolPush();
id <OFTCPSocketDelegate> delegate;
if (_socket != INVALID_SOCKET)
@throw [OFAlreadyConnectedException exceptionWithSocket: self];
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
#ifdef OF_HAVE_BLOCKS
- (void)asyncConnectToHost: (OFString *)host
port: (uint16_t)port
block: (OFTCPSocketAsyncConnectBlock)block
{
[self asyncConnectToHost: host
port: port
runLoopMode: of_run_loop_mode_default
block: block];
}
- (void)asyncConnectToHost: (OFString *)host
port: (uint16_t)port
runLoopMode: (of_run_loop_mode_t)runLoopMode
block: (OFTCPSocketAsyncConnectBlock)block
{
void *pool = objc_autoreleasePoolPush();
id <OFTCPSocketDelegate> delegate = nil;
if (_socket != INVALID_SOCKET)
@throw [OFAlreadyConnectedException exceptionWithSocket: self];
|
|
|
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
#ifdef OF_HAVE_BLOCKS
- (void)asyncConnectToHost: (OFString *)host
port: (uint16_t)port
block: (OFTCPSocketAsyncConnectBlock)block
{
[self asyncConnectToHost: host
port: port
runLoopMode: OFDefaultRunLoopMode
block: block];
}
- (void)asyncConnectToHost: (OFString *)host
port: (uint16_t)port
runLoopMode: (OFRunLoopMode)runLoopMode
block: (OFTCPSocketAsyncConnectBlock)block
{
void *pool = objc_autoreleasePoolPush();
id <OFTCPSocketDelegate> delegate = nil;
if (_socket != INVALID_SOCKET)
@throw [OFAlreadyConnectedException exceptionWithSocket: self];
|