Skip to content

Commit 6dc90ed

Browse files
author
Philip Kaufmann
committed
replace 3 separate calls to WSAGetLastError() with 1
1 parent 36db663 commit 6dc90ed

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)