Skip to content

Commit 27383b9

Browse files
committed
Merge pull request #4390
6dc90ed replace 3 separate calls to WSAGetLastError() with 1 (Philip Kaufmann)
2 parents e6cb20e + 6dc90ed commit 27383b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/netbase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
337337

338338
if (connect(hSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
339339
{
340+
int nErr = WSAGetLastError();
340341
// WSAEINVAL is here because some legacy version of winsock uses it
341-
if (WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINVAL)
342+
if (nErr == WSAEINPROGRESS || nErr == WSAEWOULDBLOCK || nErr == WSAEINVAL)
342343
{
343344
struct timeval timeout;
344345
timeout.tv_sec = nTimeout / 1000;

0 commit comments

Comments
 (0)