Network/Socket: Fix Connect (timeout) on Windows/Linux
This commit is contained in:
@@ -153,7 +153,7 @@ namespace Nz
|
||||
tv.tv_usec = static_cast<long>((msTimeout % 1000ULL) * 1000ULL);
|
||||
|
||||
int ret = select(handle + 1, nullptr, &localSet, &localSet, (msTimeout > 0) ? &tv : nullptr);
|
||||
if (ret == SOCKET_ERROR)
|
||||
if (ret > 0)
|
||||
{
|
||||
int code = GetLastErrorCode(handle, error);
|
||||
if (code < 0) //< GetLastErrorCode() failed
|
||||
|
||||
@@ -132,6 +132,7 @@ namespace Nz
|
||||
switch (errorCode) //< Check for "normal errors" first
|
||||
{
|
||||
case WSAEALREADY:
|
||||
case WSAEINVAL: //< In case of connect, WSAEINVAL may be returned instead of WSAEALREADY
|
||||
case WSAEWOULDBLOCK:
|
||||
return SocketState_Connecting;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user