swarm/pss: Move topic handler cap add to unconditional add

This commit is contained in:
lash 2018-11-14 13:10:50 +01:00
parent 122d351c62
commit 88eb8c5e36

View file

@ -322,10 +322,10 @@ func (p *Pss) Register(topic *Topic, hndlr *handler) func() {
if handlers == nil { if handlers == nil {
handlers = make(map[*handler]bool) handlers = make(map[*handler]bool)
p.handlers[*topic] = handlers p.handlers[*topic] = handlers
p.topicHandlerCaps[*topic] = hndlr.caps
log.Debug("registered handler", "caps", hndlr.caps) log.Debug("registered handler", "caps", hndlr.caps)
} }
handlers[hndlr] = true handlers[hndlr] = true
p.topicHandlerCaps[*topic] |= hndlr.caps
return func() { p.deregister(topic, hndlr) } return func() { p.deregister(topic, hndlr) }
} }
func (p *Pss) deregister(topic *Topic, hndlr *handler) { func (p *Pss) deregister(topic *Topic, hndlr *handler) {