forked from premiere/premiere-libtorrent
bandwidth manager fix
This commit is contained in:
parent
c50d08f75f
commit
f06bf0d440
|
@ -225,8 +225,14 @@ struct bandwidth_manager
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TORRENT_ASSERT(peer->max_assignable_bandwidth(m_channel) > 0);
|
|
||||||
boost::shared_ptr<Torrent> t = peer->associated_torrent().lock();
|
boost::shared_ptr<Torrent> t = peer->associated_torrent().lock();
|
||||||
|
|
||||||
|
if (peer->max_assignable_bandwidth(m_channel) == 0)
|
||||||
|
{
|
||||||
|
t->expire_bandwidth(m_channel, blk);
|
||||||
|
peer->assign_bandwidth(m_channel, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_queue.push_back(bw_queue_entry<PeerConnection>(peer, blk, non_prioritized));
|
m_queue.push_back(bw_queue_entry<PeerConnection>(peer, blk, non_prioritized));
|
||||||
if (!non_prioritized)
|
if (!non_prioritized)
|
||||||
{
|
{
|
||||||
|
@ -389,6 +395,7 @@ private:
|
||||||
if (max_assignable == 0)
|
if (max_assignable == 0)
|
||||||
{
|
{
|
||||||
t->expire_bandwidth(m_channel, qe.max_block_size);
|
t->expire_bandwidth(m_channel, qe.max_block_size);
|
||||||
|
qe.peer->assign_bandwidth(m_channel, 0);
|
||||||
TORRENT_ASSERT(amount == limit - m_current_quota);
|
TORRENT_ASSERT(amount == limit - m_current_quota);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -430,7 +437,7 @@ private:
|
||||||
if (block_size > qe.max_block_size) block_size = qe.max_block_size;
|
if (block_size > qe.max_block_size) block_size = qe.max_block_size;
|
||||||
|
|
||||||
#ifdef TORRENT_VERBOSE_BANDWIDTH_LIMIT
|
#ifdef TORRENT_VERBOSE_BANDWIDTH_LIMIT
|
||||||
std::cerr << " block_size = " << block_size << " amount = " << amount << std::endl;
|
std::cerr << " block_size = " << block_size << " amount = " << amount << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (amount < block_size / 2)
|
if (amount < block_size / 2)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue