diff --git a/src/net.cpp b/src/net.cpp index 2cb95516a48b3..a8e07a567def0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2644,10 +2644,13 @@ void CConnman::StopNodes() } // Close listening sockets. - for (ListenSocket& hListenSocket : vhListenSocket) - if (hListenSocket.socket != INVALID_SOCKET) - if (!CloseSocket(hListenSocket.socket)) + for (ListenSocket& hListenSocket : vhListenSocket) { + if (hListenSocket.socket != INVALID_SOCKET) { + if (!CloseSocket(hListenSocket.socket)) { LogPrintf("CloseSocket(hListenSocket) failed with error %s\n", NetworkErrorString(WSAGetLastError())); + } + } + } for (CNode* pnode : vNodesDisconnected) { DeleteNode(pnode);