Skip to content

Commit

Permalink
feat: don't ping same node requently
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Dec 12, 2024
1 parent 478fc88 commit 0c4c42a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/aleth/libp2p/NodeTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ bool NodeTable::addNode(Node const& _node) {
auto const it = m_allNodes.find(_node.id);
needToPing = (it == m_allNodes.end() || it->second->endpoint() != _node.get_endpoint() ||
!it->second->hasValidEndpointProof());
if (needToPing && it != m_allNodes.end() &&
it->second->lastPongReceivedTime > RLPXDatagramFace::secondsSinceEpoch() - m_requestTimeToLive.count()) {
needToPing = false;
}
}

if (needToPing) {
Expand Down

0 comments on commit 0c4c42a

Please sign in to comment.