diff --git a/whisper/whisperv5/filter.go b/whisper/whisperv5/filter.go index 1cd1181fe5..3845d0c20d 100644 --- a/whisper/whisperv5/filter.go +++ b/whisper/whisperv5/filter.go @@ -21,6 +21,7 @@ import ( "sync" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" ) @@ -81,7 +82,7 @@ func (fs *Filters) NotifyWatchers(env *Envelope, p2pMessage bool) { var msg *ReceivedMessage for j, watcher := range fs.watchers { if p2pMessage && !watcher.AcceptP2P { - glog.V(9).Infof("msg [%x], filter [%d]: p2p messages are not allowed \n", env.Hash(), j) + glog.V(logger.Detail).Infof("msg [%x], filter [%d]: p2p messages are not allowed \n", env.Hash(), j) continue } @@ -93,10 +94,10 @@ func (fs *Filters) NotifyWatchers(env *Envelope, p2pMessage bool) { if match { msg = env.Open(watcher) if msg == nil { - glog.V(9).Infof("msg [%x], filter [%d]: failed to open \n", env.Hash(), j) + glog.V(logger.Detail).Infof("msg [%x], filter [%d]: failed to open \n", env.Hash(), j) } } else { - glog.V(9).Infof("msg [%x], filter [%d]: does not match \n", env.Hash(), j) + glog.V(logger.Detail).Infof("msg [%x], filter [%d]: does not match \n", env.Hash(), j) } } diff --git a/whisper/whisperv5/whisper.go b/whisper/whisperv5/whisper.go index e673ff921c..789adbdb3e 100644 --- a/whisper/whisperv5/whisper.go +++ b/whisper/whisperv5/whisper.go @@ -363,7 +363,7 @@ func (wh *Whisper) runMessageLoop(p *Peer, rw p2p.MsgReadWriter) error { return fmt.Errorf("garbage received (directMessage)") } for _, envelope := range envelopes { - wh.postEvent(envelope, p2pCode) + wh.postEvent(envelope, true) } } case p2pRequestCode: @@ -453,22 +453,22 @@ func (wh *Whisper) add(envelope *Envelope) error { glog.V(logger.Detail).Infof("whisper envelope already cached [%x]\n", envelope.Hash()) } else { glog.V(logger.Detail).Infof("cached whisper envelope [%x]: %v\n", envelope.Hash(), envelope) - wh.postEvent(envelope, messagesCode) // notify the local node about the new message + wh.postEvent(envelope, false) // notify the local node about the new message } return nil } // postEvent queues the message for further processing. -func (w *Whisper) postEvent(envelope *Envelope, messageCode uint64) { +func (w *Whisper) postEvent(envelope *Envelope, isP2P bool) { // if the version of incoming message is higher than // currently supported version, we can not decrypt it, // and therefore just ignore this message if envelope.Ver() <= EnvelopeVersion { - if messagesCode == messageCode { + if isP2P { + w.p2pMsgQueue <- envelope + } else { w.checkOverflow() w.messageQueue <- envelope - } else { - w.p2pMsgQueue <- envelope } } }