diff options
-rw-r--r-- | src/netbase.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index 4aa7367f39..3c50174e75 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -337,8 +337,9 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe if (connect(hSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR) { + int nErr = WSAGetLastError(); // WSAEINVAL is here because some legacy version of winsock uses it - if (WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINVAL) + if (nErr == WSAEINPROGRESS || nErr == WSAEWOULDBLOCK || nErr == WSAEINVAL) { struct timeval timeout; timeout.tv_sec = nTimeout / 1000; |