113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
if (![_socket of_createSocketForAddress: &address
errNo: &errNo]) {
exception = [self of_connectionFailedExceptionForErrNo: errNo];
goto inform_delegate;
}
_socket.blocking = false;
if (![_socket of_connectSocketToAddress: &address
errNo: &errNo]) {
if (errNo == EINPROGRESS) {
[OFRunLoop of_addAsyncConnectForSocket: _socket
mode: runLoopMode
delegate: self];
|
|
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
if (![_socket of_createSocketForAddress: &address
errNo: &errNo]) {
exception = [self of_connectionFailedExceptionForErrNo: errNo];
goto inform_delegate;
}
_socket.canBlock = false;
if (![_socket of_connectSocketToAddress: &address
errNo: &errNo]) {
if (errNo == EINPROGRESS) {
[OFRunLoop of_addAsyncConnectForSocket: _socket
mode: runLoopMode
delegate: self];
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
- (void)of_socketDidConnect: (id)sock
exception: (id)exception
{
id <OFSPXSocketDelegate> delegate = ((OFSPXSocket *)sock).delegate;
if (exception == nil)
((OFSPXSocket *)sock).blocking = true;
#ifdef OF_HAVE_BLOCKS
if (_block != NULL)
_block(exception);
else {
#endif
if ([delegate respondsToSelector:
|
|
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
- (void)of_socketDidConnect: (id)sock
exception: (id)exception
{
id <OFSPXSocketDelegate> delegate = ((OFSPXSocket *)sock).delegate;
if (exception == nil)
((OFSPXSocket *)sock).canBlock = true;
#ifdef OF_HAVE_BLOCKS
if (_block != NULL)
_block(exception);
else {
#endif
if ([delegate respondsToSelector:
|
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == INVALID_SOCKET)
@throw [OFBindFailedException
exceptionWithPort: port
packetType: SPX_PACKET_TYPE
socket: self
errNo: of_socket_errno()];
_blocking = true;
#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC)
if ((flags = fcntl(_socket, F_GETFD, 0)) != -1)
fcntl(_socket, F_SETFD, flags | FD_CLOEXEC);
#endif
if (bind(_socket, &address.sockaddr.sockaddr, address.length) != 0) {
|
|
|
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == INVALID_SOCKET)
@throw [OFBindFailedException
exceptionWithPort: port
packetType: SPX_PACKET_TYPE
socket: self
errNo: of_socket_errno()];
_canBlock = true;
#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC)
if ((flags = fcntl(_socket, F_GETFD, 0)) != -1)
fcntl(_socket, F_SETFD, flags | FD_CLOEXEC);
#endif
if (bind(_socket, &address.sockaddr.sockaddr, address.length) != 0) {
|