Fix connectivity check in CActiveMasternode::ManageStateInitial (#1918)
This commit is contained in:
parent
741fcbc902
commit
312088b560
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user