Skip to content

Commit ac88b2e

Browse files
committed
Add Retry for SAPI Check
1 parent 1d8ce71 commit ac88b2e

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/smartnode/smartnode.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,18 @@ bool CSmartnodePing::CheckAndUpdate(CSmartnode* pmn, bool fFromNewBroadcast, int
821821
hostname = hostname.substr(0, pos);
822822
}
823823
// Try connecting to the SAPI port of the node
824-
if (!ConnectSocketByName(nodeAddr, hSocket, hostname.c_str(), DEFAULT_SAPI_SERVER_PORT, 2000, NULL)) {
825-
LogPrintf("CSmartnodePing::CheckAndUpdate -- Ping invalid, SAPI connection failed for SmartNode %s\n ",
824+
if (!ConnectSocketByName(nodeAddr, hSocket, hostname.c_str(), DEFAULT_SAPI_SERVER_PORT, 1000, NULL)) {
825+
LogPrintf("CSmartnodePing::CheckAndUpdate -- Ping invalid 1/2, SAPI connection failed for SmartNode %s\n ",
826826
pmn->addr.ToString());
827827
CloseSocket(hSocket);
828-
return false;
828+
if (!ConnectSocketByName(nodeAddr, hSocket, hostname.c_str(), DEFAULT_SAPI_SERVER_PORT, 2000, NULL)) {
829+
LogPrintf("CSmartnodePing::CheckAndUpdate -- Ping invalid 2/2, SAPI connection failed for SmartNode %s\n ",
830+
pmn->addr.ToString());
831+
CloseSocket(hSocket);
832+
return false;
833+
} else {
834+
CloseSocket(hSocket);
835+
}
829836
} else {
830837
CloseSocket(hSocket);
831838
}

0 commit comments

Comments
 (0)