Browse Source

bugfix: WhisperHost::noteChanged() deleted

cl-refactor
Vlad Gluhovsky 10 years ago
parent
commit
d3809ea2f8
  1. 2
      libp2p/Session.cpp
  2. 18
      libwhisper/WhisperHost.cpp
  3. 2
      libwhisper/WhisperHost.h
  4. 10
      libwhisper/WhisperPeer.cpp

2
libp2p/Session.cpp

@ -268,7 +268,7 @@ bool Session::interpret(PacketType _t, RLP const& _r)
}
catch (std::exception const& _e)
{
clog(NetWarn) << "Peer causing an exception:" << _e.what() << _r;
clog(NetWarn) << "Exception caught in p2p::Session::interpret(): " << _e.what() << ". PacketType: " << _t << ". RLP: " << _r;
disconnect(BadProtocol);
return true;
}

18
libwhisper/WhisperHost.cpp

@ -66,12 +66,13 @@ void WhisperHost::inject(Envelope const& _m, WhisperPeer* _p)
m_expiryQueue.insert(make_pair(_m.expiry(), h));
}
// if (_p)
DEV_GUARDED(m_filterLock)
{
Guard l(m_filterLock);
for (auto const& f: m_filters)
if (f.second.filter.matches(_m))
noteChanged(h, f.first);
for (auto& i: m_watches)
if (i.second.id == f.first)
i.second.changes.push_back(h);
}
// TODO p2p: capability-based rating
@ -85,17 +86,6 @@ void WhisperHost::inject(Envelope const& _m, WhisperPeer* _p)
}
}
void WhisperHost::noteChanged(h256 _messageHash, h256 _filter)
{
Guard l(m_filterLock);
for (auto& i: m_watches)
if (i.second.id == _filter)
{
cwatshh << "!!!" << i.first << i.second.id;
i.second.changes.push_back(_messageHash);
}
}
unsigned WhisperHost::installWatch(shh::Topics const& _t)
{
InstalledFilter f(_t);

2
libwhisper/WhisperHost.h

@ -71,9 +71,7 @@ protected:
private:
virtual void onStarting() override { startWorking(); }
virtual void onStopping() override { stopWorking(); }
void streamMessage(h256 _m, RLPStream& _s) const;
void noteChanged(h256 _messageHash, h256 _filter);
mutable dev::SharedMutex x_messages;
std::map<h256, Envelope> m_messages;

10
libwhisper/WhisperPeer.cpp

@ -66,17 +66,17 @@ bool WhisperPeer::interpret(unsigned _id, RLP const& _r)
noteAdvertiseTopicsOfInterest();
break;
}
case TopicFilterPacket:
{
setBloom((FixedHash<TopicBloomFilterSize>)_r[0]);
break;
}
case MessagesPacket:
{
for (auto i: _r)
host()->inject(Envelope(i), this);
break;
}
case TopicFilterPacket:
{
setBloom((FixedHash<TopicBloomFilterSize>)_r[0]);
break;
}
default:
return false;
}

Loading…
Cancel
Save