update dependencies and use preset decay fns
This commit is contained in:
parent
64e1b8b0d4
commit
2e9c9f0b0a
2
go.mod
2
go.mod
|
@ -1,7 +1,7 @@
|
|||
module github.com/libp2p/go-libp2p-pubsub
|
||||
|
||||
require (
|
||||
github.com/benbjohnson/clock v1.0.0
|
||||
github.com/benbjohnson/clock v1.0.1
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/ipfs/go-log v1.0.4
|
||||
github.com/libp2p/go-libp2p-blankhost v0.1.6
|
||||
|
|
1
go.sum
1
go.sum
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue