Browse Source

minor update

cl-refactor
Vlad Gluhovsky 10 years ago
parent
commit
784fed9a32
  1. 2
      libp2p/Session.cpp
  2. 26
      libwhisper/WhisperHost.cpp

2
libp2p/Session.cpp

@ -382,7 +382,7 @@ void Session::doRead()
}
catch (std::exception const& _e)
{
clog(NetWarn) << _e.what() << "Exception decoding frame header RLP:" << bytesConstRef(m_data.data(), h128::size).cropped(3);
clog(NetWarn) << "Exception decoding frame header RLP:" << _e.what() << bytesConstRef(m_data.data(), h128::size).cropped(3);
drop(BadProtocol);
return;
}

26
libwhisper/WhisperHost.cpp

@ -70,22 +70,16 @@ void WhisperHost::inject(Envelope const& _m, WhisperPeer* _p)
int rating = 1; // rating for local host is based upon: 1. installed watch; 2. proof of work
//if (bloomfilter.check)
//{
// rating *= 10;
if (_p) // originated externally
DEV_GUARDED(m_filterLock)
{
for (auto const& f: m_filters)
if (f.second.filter.matches(_m))
for (auto& i: m_watches)
if (i.second.id == f.first)
{
i.second.changes.push_back(h);
rating *= 10;
}
}
//}
if (_p) // incoming message from remote peer
DEV_GUARDED(m_filterLock)
for (auto const& f: m_filters)
if (f.second.filter.matches(_m))
for (auto& i: m_watches)
if (i.second.id == f.first)
{
i.second.changes.push_back(h);
rating += 10; // subject to review
}
// TODO p2p: capability-based rating
for (auto i: peerSessions())

Loading…
Cancel
Save