Commit 2e9c9f0b authored by Yusef Napora's avatar Yusef Napora Committed by vyzo

update dependencies and use preset decay fns

parent 64e1b8b0
......@@ -5,6 +5,7 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/benbjohnson/clock v1.0.1/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
......
......@@ -141,22 +141,11 @@ func (t *tagTracer) decayingDeliveryTag(topic string) (connmgr.DecayingTag, erro
}
name := fmt.Sprintf("pubsub-deliveries:%s", topic)
// decrement tag value by GossipSubConnTagDecayAmount at each decay interval
decayFn := func(value connmgr.DecayingValue) (after int, rm bool) {
v := value.Value - GossipSubConnTagDecayAmount
return v, v <= 0
}
// bump up to max of GossipSubConnTagMessageDeliveryCap
bumpFn := func(value connmgr.DecayingValue, delta int) (after int) {
val := value.Value + delta
if val > GossipSubConnTagMessageDeliveryCap {
return GossipSubConnTagMessageDeliveryCap
}
return val
}
return t.decayer.RegisterDecayingTag(name, GossipSubConnTagDecayInterval, decayFn, bumpFn)
return t.decayer.RegisterDecayingTag(
name,
GossipSubConnTagDecayInterval,
connmgr.DecayFixed(GossipSubConnTagDecayAmount),
connmgr.BumpSumBounded(0, GossipSubConnTagMessageDeliveryCap))
}
func (t *tagTracer) bumpDeliveryTag(p peer.ID, topic string) error {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment