backoff when we prune too, refuse to reGRAFT backed off peers

This commit is contained in:
vyzo 2020-03-03 18:00:59 +02:00
parent 56dbe5dc8a
commit 75fd8826af
1 changed files with 9 additions and 0 deletions

View File

@ -336,6 +336,14 @@ func (gs *GossipSubRouter) handleGraft(p peer.ID, ctl *pb.ControlMessage) []*pb.
continue continue
} }
// make sure we are not backing off that peer
_, backoff := gs.backoff[topic][p]
if backoff {
log.Debugf("GRAFT: ignoring backed off peer %s", p)
prune = append(prune, topic)
continue
}
log.Debugf("GRAFT: Add mesh link from %s in %s", p, topic) log.Debugf("GRAFT: Add mesh link from %s in %s", p, topic)
gs.tracer.Graft(p, topic) gs.tracer.Graft(p, topic)
peers[p] = struct{}{} peers[p] = struct{}{}
@ -708,6 +716,7 @@ func (gs *GossipSubRouter) heartbeat() {
gs.tracer.Prune(p, topic) gs.tracer.Prune(p, topic)
delete(peers, p) delete(peers, p)
gs.untagPeer(p, topic) gs.untagPeer(p, topic)
gs.addBackoff(p, topic)
topics := toprune[p] topics := toprune[p]
toprune[p] = append(topics, topic) toprune[p] = append(topics, topic)
} }