mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-05 22:33:10 +00:00
move score starting nil check inside the score implementation
This commit is contained in:
parent
ff89a0e619
commit
d5e432a62b
@ -184,10 +184,8 @@ func (gs *GossipSubRouter) Attach(p *PubSub) {
|
|||||||
gs.p = p
|
gs.p = p
|
||||||
gs.tracer = p.tracer
|
gs.tracer = p.tracer
|
||||||
|
|
||||||
// start the scoring, if any
|
// start the scoring
|
||||||
if gs.score != nil {
|
gs.score.Start(gs)
|
||||||
gs.score.Start(gs)
|
|
||||||
}
|
|
||||||
|
|
||||||
// start using the same msg ID function as PubSub for caching messages.
|
// start using the same msg ID function as PubSub for caching messages.
|
||||||
gs.mcache.SetMsgIdFn(p.msgID)
|
gs.mcache.SetMsgIdFn(p.msgID)
|
||||||
|
|||||||
4
score.go
4
score.go
@ -294,6 +294,10 @@ func (p *TopicScoreParams) validate() error {
|
|||||||
|
|
||||||
// router interface
|
// router interface
|
||||||
func (ps *peerScore) Start(gs *GossipSubRouter) {
|
func (ps *peerScore) Start(gs *GossipSubRouter) {
|
||||||
|
if ps == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ps.msgID = gs.p.msgID
|
ps.msgID = gs.p.msgID
|
||||||
ps.host = gs.p.host
|
ps.host = gs.p.host
|
||||||
go ps.background(gs.p.ctx)
|
go ps.background(gs.p.ctx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user