mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
net: initialize socket to avoid closing random fd's
This commit is contained in:
parent
895fbd768f
commit
96dbd381cf
@ -410,7 +410,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
|
|||||||
|
|
||||||
// Connect
|
// Connect
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
SOCKET hSocket;
|
SOCKET hSocket = INVALID_SOCKET;
|
||||||
proxyType proxy;
|
proxyType proxy;
|
||||||
if (addrConnect.IsValid()) {
|
if (addrConnect.IsValid()) {
|
||||||
bool proxyConnectionFailed = false;
|
bool proxyConnectionFailed = false;
|
||||||
|
@ -682,6 +682,9 @@ bool CloseSocket(SOCKET& hSocket)
|
|||||||
#else
|
#else
|
||||||
int ret = close(hSocket);
|
int ret = close(hSocket);
|
||||||
#endif
|
#endif
|
||||||
|
if (ret) {
|
||||||
|
LogPrintf("Socket close failed: %d. Error: %s\n", hSocket, NetworkErrorString(WSAGetLastError()));
|
||||||
|
}
|
||||||
hSocket = INVALID_SOCKET;
|
hSocket = INVALID_SOCKET;
|
||||||
return ret != SOCKET_ERROR;
|
return ret != SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user