* net.cc (cygwin_connect): Add WSAEALREADY and WSAEINVAL handling

for non-blocking sockets.
This commit is contained in:
Corinna Vinschen 2001-09-05 08:16:51 +00:00
parent 0bcb0f6a0e
commit 47497e6243
2 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Wed Sep 5 10:14:00 2001 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_connect): Add WSAEALREADY and WSAEINVAL handling
for non-blocking sockets.
Tue Sep 4 22:42:13 2001 Christopher Faylor <cgf@cygnus.com> Tue Sep 4 22:42:13 2001 Christopher Faylor <cgf@cygnus.com>
* exceptions.cc (ctrl_c_handler): Only send SIGINT when we have a * exceptions.cc (ctrl_c_handler): Only send SIGINT when we have a

View File

@ -868,13 +868,18 @@ cygwin_connect (int fd,
if (res) if (res)
{ {
/* Special handling for connect to return the correct error code /* Special handling for connect to return the correct error code
when called to early on a non-blocking socket. */ when called on a non-blocking socket. */
if (WSAGetLastError () == WSAEWOULDBLOCK) if (sock->is_nonblocking ())
{ {
WSASetLastError (WSAEINPROGRESS); DWORD err = WSAGetLastError ();
in_progress = TRUE; if (err == WSAEWOULDBLOCK || err == WSAEALREADY)
{
WSASetLastError (WSAEINPROGRESS);
in_progress = TRUE;
}
else if (err == WSAEINVAL)
WSASetLastError (WSAEISCONN);
} }
set_winsock_errno (); set_winsock_errno ();
} }
if (sock->get_addr_family () == AF_UNIX) if (sock->get_addr_family () == AF_UNIX)