mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
when a connect fails, we still want the stream scheduled to generate events
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39861 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c60508d158
commit
fc41ffdc4b
1 changed files with 32 additions and 20 deletions
|
@ -1752,27 +1752,33 @@ setNonBlocking(SOCKET fd)
|
|||
}
|
||||
}
|
||||
|
||||
if (_handler == nil)
|
||||
if (nil == _handler)
|
||||
{
|
||||
[GSTLSHandler tryInput: self output: _sibling];
|
||||
}
|
||||
|
||||
result = connect([self _sock], &_address.s,
|
||||
GSPrivateSockaddrLength(&_address.s));
|
||||
if (socketError(result))
|
||||
{
|
||||
if (!socketWouldBlock())
|
||||
if (socketWouldBlock())
|
||||
{
|
||||
[self _recordError];
|
||||
/* Need to set the status first, so that the run loop can tell
|
||||
* it needs to add the stream as waiting on writable, as an
|
||||
* indication of opened
|
||||
*/
|
||||
[self _setStatus: NSStreamStatusOpening];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Had an immediate connect error, so record it and remove
|
||||
* any handlers because we want higher level code to be
|
||||
* told about it.
|
||||
*/
|
||||
[self _setHandler: nil];
|
||||
[_sibling _setHandler: nil];
|
||||
return;
|
||||
[self _recordError];
|
||||
}
|
||||
/*
|
||||
* Need to set the status first, so that the run loop can tell
|
||||
* it needs to add the stream as waiting on writable, as an
|
||||
* indication of opened
|
||||
*/
|
||||
[self _setStatus: NSStreamStatusOpening];
|
||||
#if defined(_WIN32)
|
||||
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
|
||||
#endif
|
||||
|
@ -2228,7 +2234,7 @@ setNonBlocking(SOCKET fd)
|
|||
}
|
||||
}
|
||||
|
||||
if (_handler == nil)
|
||||
if (nil == _handler)
|
||||
{
|
||||
[GSTLSHandler tryInput: _sibling output: self];
|
||||
}
|
||||
|
@ -2237,19 +2243,25 @@ setNonBlocking(SOCKET fd)
|
|||
GSPrivateSockaddrLength(&_address.s));
|
||||
if (socketError(result))
|
||||
{
|
||||
if (!socketWouldBlock())
|
||||
if (socketWouldBlock())
|
||||
{
|
||||
[self _recordError];
|
||||
/*
|
||||
* Need to set the status first, so that the run loop can tell
|
||||
* it needs to add the stream as waiting on writable, as an
|
||||
* indication of opened
|
||||
*/
|
||||
[self _setStatus: NSStreamStatusOpening];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Had an immediate connect error, so record it and remove
|
||||
* any handlers because we want higher level code to be
|
||||
* told about it.
|
||||
*/
|
||||
[self _setHandler: nil];
|
||||
[_sibling _setHandler: nil];
|
||||
return;
|
||||
[self _recordError];
|
||||
}
|
||||
/*
|
||||
* Need to set the status first, so that the run loop can tell
|
||||
* it needs to add the stream as waiting on writable, as an
|
||||
* indication of opened
|
||||
*/
|
||||
[self _setStatus: NSStreamStatusOpening];
|
||||
#if defined(_WIN32)
|
||||
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue