* fhandler_socket.cc (fhandler_socket::connect): Change error
handling for nonblocking connects to return EALREADY when connect is called more than once for the same socket.
This commit is contained in:
parent
729d1ff9d8
commit
f496071c40
|
@ -1,3 +1,9 @@
|
||||||
|
2003-06-07 Thomas Pfaff <tpfaff@gmx.net>
|
||||||
|
|
||||||
|
* fhandler_socket.cc (fhandler_socket::connect): Change error
|
||||||
|
handling for nonblocking connects to return EALREADY when
|
||||||
|
connect is called more than once for the same socket.
|
||||||
|
|
||||||
2003-06-06 Corinna Vinschen <corinna@vinschen.de>
|
2003-06-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cygwin.din: Add vsyslog.
|
* cygwin.din: Add vsyslog.
|
||||||
|
|
|
@ -502,6 +502,7 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
||||||
BOOL in_progress = FALSE;
|
BOOL in_progress = FALSE;
|
||||||
sockaddr_in sin;
|
sockaddr_in sin;
|
||||||
int secret [4];
|
int secret [4];
|
||||||
|
DWORD err;
|
||||||
|
|
||||||
if (!get_inet_addr (name, namelen, &sin, &namelen, secret))
|
if (!get_inet_addr (name, namelen, &sin, &namelen, secret))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -514,12 +515,12 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
||||||
when called on a non-blocking socket. */
|
when called on a non-blocking socket. */
|
||||||
if (is_nonblocking () || is_connect_pending ())
|
if (is_nonblocking () || is_connect_pending ())
|
||||||
{
|
{
|
||||||
DWORD err = WSAGetLastError ();
|
err = WSAGetLastError ();
|
||||||
if (err == WSAEWOULDBLOCK || err == WSAEALREADY)
|
if (err == WSAEWOULDBLOCK || err == WSAEALREADY)
|
||||||
{
|
|
||||||
WSASetLastError (WSAEINPROGRESS);
|
|
||||||
in_progress = TRUE;
|
in_progress = TRUE;
|
||||||
}
|
|
||||||
|
if (err == WSAEWOULDBLOCK)
|
||||||
|
WSASetLastError (WSAEINPROGRESS);
|
||||||
else if (err == WSAEINVAL)
|
else if (err == WSAEINVAL)
|
||||||
WSASetLastError (WSAEISCONN);
|
WSASetLastError (WSAEISCONN);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +557,8 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WSAGetLastError () == WSAEINPROGRESS)
|
err = WSAGetLastError ();
|
||||||
|
if (err == WSAEINPROGRESS || err == WSAEALREADY)
|
||||||
set_connect_state (CONNECT_PENDING);
|
set_connect_state (CONNECT_PENDING);
|
||||||
else
|
else
|
||||||
set_connect_state (CONNECTED);
|
set_connect_state (CONNECTED);
|
||||||
|
|
Loading…
Reference in New Issue