mirror of https://github.com/waku-org/nwaku.git
Fix: No keep-alive for backoff peers (#584)
This commit is contained in:
parent
8f741de483
commit
ee757308c6
|
@ -28,9 +28,15 @@ proc keepAlive*(w: WakuRelay) {.async.} =
|
|||
|
||||
for topic in w.topics.keys:
|
||||
trace "Keepalive on topic", topic=topic
|
||||
let mpeers = w.mesh.getOrDefault(topic)
|
||||
let
|
||||
# Mesh peers for topic
|
||||
mpeers = toSeq(w.mesh.getOrDefault(topic))
|
||||
# Peers we're backing off from on topic
|
||||
backoffPeers = w.backingOff.getOrDefault(topic)
|
||||
# Only keep peers alive that we're not backing off from
|
||||
keepAlivePeers = mpeers.filterIt(not backoffPeers.hasKey(it.peerId))
|
||||
|
||||
w.broadcast(toSeq(mpeers), RPCMsg(control: some(ControlMessage(graft: @[ControlGraft(topicID: topic)]))))
|
||||
w.broadcast(keepAlivePeers, RPCMsg(control: some(ControlMessage(graft: @[ControlGraft(topicID: topic)]))))
|
||||
|
||||
await sleepAsync(DefaultKeepAlive)
|
||||
|
||||
|
|
Loading…
Reference in New Issue