|
|
@ -80,7 +80,6 @@ HashDownloadSub::HashDownloadSub(HashDownloadMan& _man): m_man(&_man) |
|
|
|
{ |
|
|
|
WriteGuard l(m_man->x_subs); |
|
|
|
m_asked = RangeMask<unsigned>(m_man->m_chainStart, m_man->m_chainStart + m_man->m_chainCount); |
|
|
|
m_attempted = RangeMask<unsigned>(m_man->m_chainStart, m_man->m_chainStart + m_man->m_chainCount); |
|
|
|
m_man->m_subs.insert(this); |
|
|
|
} |
|
|
|
|
|
|
@ -98,7 +97,6 @@ void HashDownloadSub::resetFetch() |
|
|
|
Guard l(m_fetch); |
|
|
|
m_remaining = 0; |
|
|
|
m_asked = RangeMask<unsigned>(m_man->m_chainStart, m_man->m_chainStart + m_man->m_chainCount); |
|
|
|
m_attempted = RangeMask<unsigned>(m_man->m_chainStart, m_man->m_chainStart + m_man->m_chainCount); |
|
|
|
} |
|
|
|
|
|
|
|
unsigned HashDownloadSub::nextFetch(unsigned _n) |
|
|
@ -110,10 +108,9 @@ unsigned HashDownloadSub::nextFetch(unsigned _n) |
|
|
|
if (!m_man || m_man->chainEmpty()) |
|
|
|
return 0; |
|
|
|
|
|
|
|
m_asked = (~(m_man->taken() + m_attempted)).lowest(_n); |
|
|
|
m_asked = (~(m_man->taken())).lowest(_n); |
|
|
|
if (m_asked.empty()) |
|
|
|
m_asked = (~(m_man->taken(true) + m_attempted)).lowest(_n); |
|
|
|
m_attempted += m_asked; |
|
|
|
m_asked = (~(m_man->taken(true))).lowest(_n); |
|
|
|
return *m_asked.begin(); |
|
|
|
} |
|
|
|
|
|
|
|