Browse Source

Add mutexed askedContains in placed of .asked.contains(). Issue #333 (dev::RangeMask<unsigned int>::contains), nextFetch clears m_asked concurrent to m_asked.contains() iteration.

cl-refactor
subtly 10 years ago
parent
commit
2ed2d479c6
  1. 2
      alethzero/DownloadView.cpp
  2. 3
      libethereum/DownloadMan.h

2
alethzero/DownloadView.cpp

@ -63,7 +63,7 @@ void DownloadView::paintEvent(QPaintEvent*)
unsigned h = 0;
m_man->foreachSub([&](DownloadSub const& sub)
{
if (sub.asked().contains(i))
if (sub.askedContains(i))
s = h;
h++;
});

3
libethereum/DownloadMan.h

@ -54,6 +54,7 @@ public:
/// Nothing doing here.
void doneFetch() { resetFetch(); }
bool askedContains(unsigned _i) const { Guard l(m_fetch); return m_asked.contains(_i); }
RangeMask<unsigned> const& asked() const { return m_asked; }
RangeMask<unsigned> const& attemped() const { return m_attempted; }
@ -69,7 +70,7 @@ private:
DownloadMan* m_man = nullptr;
Mutex m_fetch;
mutable Mutex m_fetch;
h256Set m_remaining;
std::map<h256, unsigned> m_indices;
RangeMask<unsigned> m_asked;

Loading…
Cancel
Save