add backoff when pruning because of negative score

This commit is contained in:
vyzo 2020-03-23 08:29:46 +02:00
parent 15d204cc14
commit 6bcaacd74b
1 changed files with 3 additions and 0 deletions

View File

@ -387,6 +387,8 @@ func (gs *GossipSubRouter) handleGraft(p peer.ID, ctl *pb.ControlMessage) []*pb.
prune = append(prune, topic)
// but we won't PX to them
doPX = false
// add/refresh backoff so that we don't reGRAFT too early even if the score decays back up
gs.addBackoff(p, topic)
continue
}
@ -394,6 +396,7 @@ func (gs *GossipSubRouter) handleGraft(p peer.ID, ctl *pb.ControlMessage) []*pb.
_, backoff := gs.backoff[topic][p]
if backoff {
log.Debugf("GRAFT: ignoring backed off peer %s", p)
// refresh the backoff
gs.addBackoff(p, topic)
prune = append(prune, topic)
continue