You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (nTime - pnode->nTimeConnected > m_peer_connect_timeout)
1494
-
{
1495
-
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
1496
-
{
1497
-
LogPrint(BCLog::NET, "socket no message in first %i seconds, %d %d from %d\n", m_peer_connect_timeout, pnode->nLastRecv != 0, pnode->nLastSend != 0, pnode->GetId());
LogPrint(BCLog::NET, "version handshake timeout from %d\n", pnode->GetId());
1518
-
pnode->fDisconnect = true;
1519
-
}
1492
+
// Use non-mockable system time (otherwise these timers will pop when we
1493
+
// use setmocktime in the tests).
1494
+
int64_t now = GetSystemTimeInSeconds();
1495
+
1496
+
if (now <= node.nTimeConnected + m_peer_connect_timeout) {
1497
+
// Only run inactivity checks if the peer has been connected longer
1498
+
// than m_peer_connect_timeout.
1499
+
returnfalse;
1520
1500
}
1501
+
1502
+
if (node.nLastRecv == 0 || node.nLastSend == 0) {
1503
+
LogPrint(BCLog::NET, "socket no message in first %i seconds, %d %d from %d\n", m_peer_connect_timeout, node.nLastRecv != 0, node.nLastSend != 0, node.GetId());
1504
+
returntrue;
1505
+
}
1506
+
1507
+
if (now > node.nLastSend + TIMEOUT_INTERVAL) {
1508
+
LogPrintf("socket sending timeout: %is\n", now - node.nLastSend);
1509
+
returntrue;
1510
+
}
1511
+
1512
+
if (now > node.nLastRecv + TIMEOUT_INTERVAL) {
1513
+
LogPrintf("socket receive timeout: %is\n", now - node.nLastRecv);
0 commit comments