Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 1,440 Lines • ▼ Show 20 Lines | if (now > node.nLastSend + TIMEOUT_INTERVAL) { | ||||
return true; | return true; | ||||
} | } | ||||
if (now > node.nLastRecv + TIMEOUT_INTERVAL) { | if (now > node.nLastRecv + TIMEOUT_INTERVAL) { | ||||
LogPrintf("socket receive timeout: %is\n", now - node.nLastRecv); | LogPrintf("socket receive timeout: %is\n", now - node.nLastRecv); | ||||
return true; | return true; | ||||
} | } | ||||
if (node.nPingNonceSent && | |||||
node.m_ping_start.load() + std::chrono::seconds{TIMEOUT_INTERVAL} < | |||||
GetTime<std::chrono::microseconds>()) { | |||||
// We use mockable time for ping timeouts. This means that setmocktime | |||||
// may cause pings to time out for peers that have been connected for | |||||
// longer than m_peer_connect_timeout. | |||||
LogPrintf("ping timeout: %fs\n", | |||||
0.000001 * | |||||
count_microseconds(GetTime<std::chrono::microseconds>() - | |||||
node.m_ping_start.load())); | |||||
return true; | |||||
} | |||||
if (!node.fSuccessfullyConnected) { | if (!node.fSuccessfullyConnected) { | ||||
LogPrint(BCLog::NET, "version handshake timeout from %d\n", | LogPrint(BCLog::NET, "version handshake timeout from %d\n", | ||||
node.GetId()); | node.GetId()); | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,036 Lines • Show Last 20 Lines |