mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
swarm/pss: fucntion signature changed
This commit is contained in:
parent
1ca00afa2d
commit
5b30d7850f
1 changed files with 5 additions and 8 deletions
|
|
@ -467,15 +467,12 @@ func (p *Pss) process(pssmsg *PssMsg, raw bool, prox bool) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy all registered handlers for respective topic in order to avoid deadlock
|
// copy all registered handlers for respective topic in order to avoid data race or deadlock
|
||||||
func (p *Pss) getHandlers(topic Topic) map[*handler]bool {
|
func (p *Pss) getHandlers(topic Topic) (ret []*handler) {
|
||||||
p.handlersMu.RLock()
|
p.handlersMu.RLock()
|
||||||
defer p.handlersMu.RUnlock()
|
defer p.handlersMu.RUnlock()
|
||||||
|
for k, _ := range p.handlers[topic] {
|
||||||
ret := make(map[*handler]bool)
|
ret = append(ret, k)
|
||||||
h := p.handlers[topic]
|
|
||||||
for k, v := range h {
|
|
||||||
ret[k] = v
|
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +480,7 @@ func (p *Pss) getHandlers(topic Topic) map[*handler]bool {
|
||||||
func (p *Pss) executeHandlers(topic Topic, payload []byte, from PssAddress, raw bool, prox bool, asymmetric bool, keyid string) {
|
func (p *Pss) executeHandlers(topic Topic, payload []byte, from PssAddress, raw bool, prox bool, asymmetric bool, keyid string) {
|
||||||
handlers := p.getHandlers(topic)
|
handlers := p.getHandlers(topic)
|
||||||
peer := p2p.NewPeer(enode.ID{}, fmt.Sprintf("%x", from), []p2p.Cap{})
|
peer := p2p.NewPeer(enode.ID{}, fmt.Sprintf("%x", from), []p2p.Cap{})
|
||||||
for h := range handlers {
|
for _, h := range handlers {
|
||||||
if !h.caps.raw && raw {
|
if !h.caps.raw && raw {
|
||||||
log.Warn("norawhandler")
|
log.Warn("norawhandler")
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue