mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Reduce PING frequency and simplify logic:
The existing code issues a PING to each peer every 8 seconds. While frequent PINGs allow us to estimate a peer's latency with a high degree of accuracy, this "inter-server polka dance" is inefficient and not useful. This commit, if merged, reduces the PING frequency to once every 60 seconds. Additionally, this commit simplifies the PING handling logic and merges the code used to check and disconnect peers which fail to track the network directly into the timer callback.
This commit is contained in:
@@ -100,9 +100,6 @@ OverlayImpl::Timer::on_timer(error_code ec)
|
||||
overlay_.sendEndpoints();
|
||||
overlay_.autoConnect();
|
||||
|
||||
if ((++overlay_.timer_count_ % Tuning::checkSeconds) == 0)
|
||||
overlay_.check();
|
||||
|
||||
if ((overlay_.timer_count_ % Tuning::checkIdlePeers) == 0)
|
||||
overlay_.deleteIdlePeers();
|
||||
|
||||
@@ -1187,12 +1184,6 @@ OverlayImpl::checkTracking(std::uint32_t index)
|
||||
[index](std::shared_ptr<PeerImp>&& sp) { sp->checkTracking(index); });
|
||||
}
|
||||
|
||||
void
|
||||
OverlayImpl::check()
|
||||
{
|
||||
for_each([](std::shared_ptr<PeerImp>&& sp) { sp->check(); });
|
||||
}
|
||||
|
||||
std::shared_ptr<Peer>
|
||||
OverlayImpl::findPeerByShortID(Peer::id_t const& id) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user