Browse Source

Mutex & reference counter

cl-refactor
Vlad Gluhovsky 10 years ago
parent
commit
43f0112456
  1. 5
      libwhisper/WhisperHost.cpp
  2. 3
      libwhisper/WhisperPeer.cpp

5
libwhisper/WhisperHost.cpp

@ -94,8 +94,11 @@ unsigned WhisperHost::installWatch(shh::Topics const& _t)
DEV_GUARDED(m_filterLock)
{
if (!m_filters.count(h))
auto it = m_filters.find(h);
if (m_filters.end() == it)
m_filters.insert(make_pair(h, f));
else
it->second.refCount++;
ret = m_watches.size() ? m_watches.rbegin()->first + 1 : 0;
m_watches[ret] = ClientWatch(h);

3
libwhisper/WhisperPeer.cpp

@ -58,7 +58,10 @@ bool WhisperPeer::interpret(unsigned _id, RLP const& _r)
disable("Invalid protocol version.");
for (auto const& m: host()->all())
{
Guard l(x_unseen);
m_unseen.insert(make_pair(0, m.first));
}
if (session()->id() < host()->host()->id())
sendMessages();

Loading…
Cancel
Save