ObjFW  Diff

Differences From Artifact [65dc3f6ee6]:

To Artifact [cb1a9316c7]:


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

	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];







|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

	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];
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
- (void)of_socketDidConnect: (id)sock
		  exception: (id)exception
{
	id <OFSPXStreamSocketDelegate> delegate =
	    ((OFSPXStreamSocket *)sock).delegate;

	if (exception == nil)
		((OFSPXStreamSocket *)sock).blocking = true;

#ifdef OF_HAVE_BLOCKS
	if (_block != NULL)
		_block(exception);
	else {
#endif
		if ([delegate respondsToSelector:







|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
- (void)of_socketDidConnect: (id)sock
		  exception: (id)exception
{
	id <OFSPXStreamSocketDelegate> delegate =
	    ((OFSPXStreamSocket *)sock).delegate;

	if (exception == nil)
		((OFSPXStreamSocket *)sock).canBlock = true;

#ifdef OF_HAVE_BLOCKS
	if (_block != NULL)
		_block(exception);
	else {
#endif
		if ([delegate respondsToSelector:
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
	    SOCK_STREAM | 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) {







|







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
	    SOCK_STREAM | 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) {