log counts in IHAVE flood protection measures

This commit is contained in:
vyzo 2020-04-20 16:43:33 +03:00
parent a645afd1b3
commit 8bc2c5c0f1
1 changed files with 4 additions and 4 deletions

View File

@ -382,14 +382,14 @@ func (gs *GossipSubRouter) handleIHave(p peer.ID, ctl *pb.ControlMessage) []*pb.
}
// IHAVE flood protection
gs.peerhave[p]++
if gs.peerhave[p] > GossipSubMaxIHaveMessages {
log.Debugf("IHAVE: peer %s has advertised too many times within this heartbeat interval; ignoring", p)
log.Debugf("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring", p, gs.peerhave[p])
return nil
}
gs.peerhave[p]++
if gs.iasked[p] >= GossipSubMaxIHaveLength {
log.Debugf("IHAVE: peer %s has already advertised too many messages; ignoring", p)
log.Debugf("IHAVE: peer %s has already advertised too many messages (%d); ignoring", p, gs.iasked[p])
return nil
}
@ -418,7 +418,7 @@ func (gs *GossipSubRouter) handleIHave(p peer.ID, ctl *pb.ControlMessage) []*pb.
iask = GossipSubMaxIHaveLength - gs.iasked[p]
}
log.Debugf("IHAVE: Asking for %d messages from %s", iask, p)
log.Debugf("IHAVE: Asking for %d out of %d messages from %s", iask, len(iwant), p)
iwantlst := make([]string, 0, len(iwant))
for mid := range iwant {