From ca595277e62502f8274ab76a931688f79c8b52aa Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 1 Jun 2022 23:11:35 +0300 Subject: [PATCH] fix: iterate through Network peers during ping process (#182) --- waku/v2/node/keepalive.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/waku/v2/node/keepalive.go b/waku/v2/node/keepalive.go index 69e9990b..52fe0bb4 100644 --- a/waku/v2/node/keepalive.go +++ b/waku/v2/node/keepalive.go @@ -26,13 +26,9 @@ func (w *WakuNode) startKeepAlive(t time.Duration) { for { select { case <-ticker.C: - // Compared to Network's peers collection, - // Peerstore contains all peers ever connected to, - // thus if a host goes down and back again, - // pinging a peer will trigger identification process, - // which is not possible when iterating - // through Network's peer collection, as it will be empty - for _, p := range w.host.Peerstore().Peers() { + // Network's peers collection, + // contains only currently active peers + for _, p := range w.host.Network().Peers() { if p != w.host.ID() { w.wg.Add(1) go w.pingPeer(p)