From 8bc2c5c0f1e3de691ecd54b5efd5c4cbb14fe9e8 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 20 Apr 2020 16:43:33 +0300 Subject: [PATCH] log counts in IHAVE flood protection measures --- gossipsub.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gossipsub.go b/gossipsub.go index a0387bd..3c558f3 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -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 {