mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-06 14:53:07 +00:00
make maximum number of IHAVE messages accepted per heartbeat configurable
This commit is contained in:
parent
8150843cf3
commit
9ab44c5069
@ -82,6 +82,9 @@ var (
|
||||
// system is pushing more than 5000 messages in GossipSubHistoryGossip heartbeats; with the
|
||||
// defaults this is 1666 messages/s.
|
||||
GossipSubMaxIHaveLength = 5000
|
||||
|
||||
// Maximum number of IHAVE messages to accept from a peer within a heartbeat.
|
||||
GossipSubMaxIHaveMessages = 10
|
||||
)
|
||||
|
||||
// NewGossipSub returns a new PubSub object using GossipSubRouter as the router.
|
||||
@ -376,7 +379,7 @@ func (gs *GossipSubRouter) handleIHave(p peer.ID, ctl *pb.ControlMessage) []*pb.
|
||||
}
|
||||
|
||||
// IHAVE flood protection
|
||||
if gs.peerhave[p] > 2 {
|
||||
if gs.peerhave[p] > GossipSubMaxIHaveMessages {
|
||||
log.Debugf("IHAVE: peer %s has advertised too many times within this heartbeat interval; ignoring", p)
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user