mirror of https://github.com/status-im/go-waku.git
fix: iterate through Network peers during ping process (#182)
This commit is contained in:
parent
80385bf78e
commit
ca595277e6
|
@ -26,13 +26,9 @@ func (w *WakuNode) startKeepAlive(t time.Duration) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
// Compared to Network's peers collection,
|
// Network's peers collection,
|
||||||
// Peerstore contains all peers ever connected to,
|
// contains only currently active peers
|
||||||
// thus if a host goes down and back again,
|
for _, p := range w.host.Network().Peers() {
|
||||||
// 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() {
|
|
||||||
if p != w.host.ID() {
|
if p != w.host.ID() {
|
||||||
w.wg.Add(1)
|
w.wg.Add(1)
|
||||||
go w.pingPeer(p)
|
go w.pingPeer(p)
|
||||||
|
|
Loading…
Reference in New Issue