Fix connectivity check in CActiveMasternode::ManageStateInitial (#1918)

This commit is contained in:
UdjinM6 2018-02-12 15:46:38 +03:00 committed by GitHub
parent 741fcbc902
commit 312088b560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@
#include "masternode.h"
#include "masternode-sync.h"
#include "masternodeman.h"
#include "netbase.h"
#include "protocol.h"
// Keep track of the active Masternode
@ -180,12 +181,13 @@ void CActiveMasternode::ManageStateInitial(CConnman& connman)
return;
}
// Check socket connectivity
LogPrintf("CActiveMasternode::ManageStateInitial -- Checking inbound connection to '%s'\n", service.ToString());
SOCKET hSocket;
bool fConnected = ConnectSocket(service, hSocket, nConnectTimeout) && IsSelectableSocket(hSocket);
CloseSocket(hSocket);
CAddress addr(service, NODE_NETWORK);
connman.OpenMasternodeConnection(addr);
if (!connman.IsConnected(addr, CConnman::AllNodes)) {
if (!fConnected) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Could not connect to " + service.ToString();
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);