From bd623937c9ad9b227aff096ebc4d39c3b8a7d7d7 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Sun, 22 Jun 2014 20:17:15 +0200 Subject: [PATCH] replace 3 separate calls to WSAGetLastError() with 1 --- src/netbase.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/netbase.cpp b/src/netbase.cpp index 1e7172e..00e4bfd 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -359,8 +359,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; -- 1.7.1