|
|
@ -391,7 +391,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo |
|
|
|
uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize(); |
|
|
|
uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize(); |
|
|
|
CNode* pnode = new CNode(id, nLocalServices, GetBestHeight(), hSocket, addrConnect, CalculateKeyedNetGroup(addrConnect), nonce, pszDest ? pszDest : "", false); |
|
|
|
CNode* pnode = new CNode(id, nLocalServices, GetBestHeight(), hSocket, addrConnect, CalculateKeyedNetGroup(addrConnect), nonce, pszDest ? pszDest : "", false); |
|
|
|
pnode->nServicesExpected = ServiceFlags(addrConnect.nServices & nRelevantServices); |
|
|
|
pnode->nServicesExpected = ServiceFlags(addrConnect.nServices & nRelevantServices); |
|
|
|
pnode->nTimeConnected = GetTime(); |
|
|
|
pnode->nTimeConnected = GetSystemTimeInSeconds(); |
|
|
|
pnode->AddRef(); |
|
|
|
pnode->AddRef(); |
|
|
|
GetNodeSignals().InitializeNode(pnode, *this); |
|
|
|
GetNodeSignals().InitializeNode(pnode, *this); |
|
|
|
{ |
|
|
|
{ |
|
|
@ -771,7 +771,7 @@ size_t CConnman::SocketSendData(CNode *pnode) |
|
|
|
assert(data.size() > pnode->nSendOffset); |
|
|
|
assert(data.size() > pnode->nSendOffset); |
|
|
|
int nBytes = send(pnode->hSocket, reinterpret_cast<const char*>(data.data()) + pnode->nSendOffset, data.size() - pnode->nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT); |
|
|
|
int nBytes = send(pnode->hSocket, reinterpret_cast<const char*>(data.data()) + pnode->nSendOffset, data.size() - pnode->nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT); |
|
|
|
if (nBytes > 0) { |
|
|
|
if (nBytes > 0) { |
|
|
|
pnode->nLastSend = GetTime(); |
|
|
|
pnode->nLastSend = GetSystemTimeInSeconds(); |
|
|
|
pnode->nSendBytes += nBytes; |
|
|
|
pnode->nSendBytes += nBytes; |
|
|
|
pnode->nSendOffset += nBytes; |
|
|
|
pnode->nSendOffset += nBytes; |
|
|
|
nSentSize += nBytes; |
|
|
|
nSentSize += nBytes; |
|
|
@ -1280,7 +1280,7 @@ void CConnman::ThreadSocketHandler() |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Inactivity checking
|
|
|
|
// Inactivity checking
|
|
|
|
//
|
|
|
|
//
|
|
|
|
int64_t nTime = GetTime(); |
|
|
|
int64_t nTime = GetSystemTimeInSeconds(); |
|
|
|
if (nTime - pnode->nTimeConnected > 60) |
|
|
|
if (nTime - pnode->nTimeConnected > 60) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0) |
|
|
|
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0) |
|
|
@ -2565,7 +2565,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn |
|
|
|
nLastRecv = 0; |
|
|
|
nLastRecv = 0; |
|
|
|
nSendBytes = 0; |
|
|
|
nSendBytes = 0; |
|
|
|
nRecvBytes = 0; |
|
|
|
nRecvBytes = 0; |
|
|
|
nTimeConnected = GetTime(); |
|
|
|
nTimeConnected = GetSystemTimeInSeconds(); |
|
|
|
nTimeOffset = 0; |
|
|
|
nTimeOffset = 0; |
|
|
|
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; |
|
|
|
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; |
|
|
|
nVersion = 0; |
|
|
|
nVersion = 0; |
|
|
|