mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-03-05 02:26:01 +00:00
prevent SOCKET leak in BindListenPort()
- the call to CloseSocket() is placed after the WSAGetLastError(), because a CloseSocket() can trigger an error also, which we don't want for the logging in this two cases
This commit is contained in:
parent
a15d1b4fc1
commit
c118e9d275
@ -1671,6 +1671,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
|
||||
else
|
||||
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
|
||||
LogPrintf("%s\n", strError);
|
||||
CloseSocket(hListenSocket);
|
||||
return false;
|
||||
}
|
||||
LogPrintf("Bound to %s\n", addrBind.ToString());
|
||||
@ -1680,6 +1681,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
|
||||
{
|
||||
strError = strprintf(_("Error: Listening for incoming connections failed (listen returned error %s)"), NetworkErrorString(WSAGetLastError()));
|
||||
LogPrintf("%s\n", strError);
|
||||
CloseSocket(hListenSocket);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user