Commit 14c820b1 by Edward Thomson

win32: use WSAGetLastError to determine blocking

parent 03eebab8
......@@ -114,6 +114,19 @@ static int handle_sockerr(GIT_SOCKET socket)
return -1;
}
GIT_INLINE(bool) connect_would_block(int error)
{
#ifdef GIT_WIN32
if (error == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK)
return true;
#endif
if (error == -1 && errno == EINPROGRESS)
return true;
return false;
}
static int connect_with_timeout(
GIT_SOCKET socket,
const struct sockaddr *address,
......@@ -128,7 +141,7 @@ static int connect_with_timeout(
error = connect(socket, address, address_len);
if (error == 0 || (error == -1 && errno != EINPROGRESS))
if (error == 0 || !connect_would_block(error))
return error;
fd.fd = socket;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment