fix pause, piece picker, and bandwidth limit bugs

This commit is contained in:
Marcos Pinto 2007-08-23 01:48:21 +00:00
parent ae37b3aa39
commit 575c6f5e4f
3 changed files with 11 additions and 1 deletions

View File

@ -398,6 +398,7 @@ private:
block_size = m_limit
/ (m_limit / max_bandwidth_block_size);
}
if (block_size > qe.max_block_size) block_size = qe.max_block_size;
}
if (amount < block_size / 2)

View File

@ -639,7 +639,7 @@ namespace libtorrent
if (dp == m_downloads.begin()) return;
int complete = dp->writing + dp->finished;
for (std::vector<downloading_piece>::iterator i = dp, j(dp-1);
i != m_downloads.begin() && j != m_downloads.begin(); --i, --j)
i != m_downloads.begin(); --i, --j)
{
assert(j >= m_downloads.begin());
if (j->finished + j->writing >= complete) return;

View File

@ -1068,7 +1068,16 @@ namespace detail
&& !t->is_seed()))
{
if (!i->second->is_choked() && t)
{
policy::peer* pi = p->peer_info_struct();
if (pi && pi->optimistically_unchoked)
{
pi->optimistically_unchoked = false;
// force a new optimistic unchoke
m_optimistic_unchoke_time_scaler = 0;
}
t->choke_peer(*i->second);
}
continue;
}
peers.push_back(i->second.get());