mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
swarm/pss: Move rawtopic test before decryption attempt
This commit is contained in:
parent
538c31101f
commit
3e10f30bca
1 changed files with 8 additions and 17 deletions
|
|
@ -361,6 +361,10 @@ func (self *Pss) process(pssmsg *PssMsg) bool {
|
|||
|
||||
envelope := pssmsg.Payload
|
||||
psstopic := Topic(envelope.Topic)
|
||||
if self.allowRaw && psstopic == rawTopic {
|
||||
self.executeHandlers(rawTopic, envelope.Data, nil, false, "")
|
||||
return true
|
||||
}
|
||||
|
||||
if len(envelope.AESNonce) > 0 { // detect symkey msg according to whisperv5/envelope.go:OpenSymmetric
|
||||
keyFunc = self.processSym
|
||||
|
|
@ -370,9 +374,6 @@ func (self *Pss) process(pssmsg *PssMsg) bool {
|
|||
}
|
||||
recvmsg, keyid, from, err = keyFunc(envelope)
|
||||
if err != nil {
|
||||
if self.allowRaw {
|
||||
self.executeHandlers(rawTopic, envelope.Data, nil, false, "")
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -382,9 +383,6 @@ func (self *Pss) process(pssmsg *PssMsg) bool {
|
|||
return false
|
||||
}
|
||||
}
|
||||
if psstopic == rawTopic {
|
||||
return false
|
||||
}
|
||||
self.executeHandlers(psstopic, recvmsg.Payload, from, asymmetric, keyid)
|
||||
|
||||
return true
|
||||
|
|
@ -609,13 +607,11 @@ func (self *Pss) cleanKeys() (count int) {
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
func (self *Pss) enqueue(msg *PssMsg) bool {
|
||||
self.fwdPoolMu.Lock()
|
||||
defer self.fwdPoolMu.Unlock()
|
||||
if self.outboxCounter == self.outboxCapacity {
|
||||
return false
|
||||
select {
|
||||
case self.outbox <- msg:
|
||||
return true
|
||||
default:
|
||||
}
|
||||
self.outboxCounter++
|
||||
self.outbox <- msg
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -810,11 +806,6 @@ func (self *Pss) forward(msg *PssMsg) error {
|
|||
}
|
||||
}
|
||||
|
||||
// remove from queue
|
||||
self.fwdPoolMu.Lock()
|
||||
self.outboxCounter--
|
||||
self.fwdPoolMu.Unlock()
|
||||
|
||||
// cache the message
|
||||
self.addFwdCache(msg)
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue