mirror of https://github.com/vacp2p/nim-libp2p.git
expose seenTTL parameters (#457)
This commit is contained in:
parent
ca9c5c85e4
commit
6c7f2766fe
|
@ -121,6 +121,7 @@ type
|
||||||
historyGossip*: int
|
historyGossip*: int
|
||||||
|
|
||||||
fanoutTTL*: Duration
|
fanoutTTL*: Duration
|
||||||
|
seenTTL*: Duration
|
||||||
|
|
||||||
gossipThreshold*: float64
|
gossipThreshold*: float64
|
||||||
publishThreshold*: float64
|
publishThreshold*: float64
|
||||||
|
@ -195,6 +196,7 @@ proc init*(_: type[GossipSubParams]): GossipSubParams =
|
||||||
historyLength: GossipSubHistoryLength,
|
historyLength: GossipSubHistoryLength,
|
||||||
historyGossip: GossipSubHistoryGossip,
|
historyGossip: GossipSubHistoryGossip,
|
||||||
fanoutTTL: GossipSubFanoutTTL,
|
fanoutTTL: GossipSubFanoutTTL,
|
||||||
|
seenTTL: 2.minutes,
|
||||||
gossipThreshold: -10,
|
gossipThreshold: -10,
|
||||||
publishThreshold: -100,
|
publishThreshold: -100,
|
||||||
graylistThreshold: -10000,
|
graylistThreshold: -10000,
|
||||||
|
@ -1352,6 +1354,12 @@ method initPubSub*(g: GossipSub) =
|
||||||
g.parameters.validateParameters().tryGet()
|
g.parameters.validateParameters().tryGet()
|
||||||
|
|
||||||
randomize()
|
randomize()
|
||||||
|
|
||||||
|
# init the floodsub stuff here, we customize timedcache in gossip!
|
||||||
|
g.floodsub = initTable[string, HashSet[PubSubPeer]]()
|
||||||
|
g.seen = TimedCache[MessageID].init(g.parameters.seenTTL)
|
||||||
|
|
||||||
|
# init gossip stuff
|
||||||
g.mcache = MCache.init(g.parameters.historyGossip, g.parameters.historyLength)
|
g.mcache = MCache.init(g.parameters.historyGossip, g.parameters.historyLength)
|
||||||
g.mesh = initTable[string, HashSet[PubSubPeer]]() # meshes - topic to peer
|
g.mesh = initTable[string, HashSet[PubSubPeer]]() # meshes - topic to peer
|
||||||
g.fanout = initTable[string, HashSet[PubSubPeer]]() # fanout - topic to peer
|
g.fanout = initTable[string, HashSet[PubSubPeer]]() # fanout - topic to peer
|
||||||
|
|
Loading…
Reference in New Issue