forked from premiere/premiere-libtorrent
also use separate lower limits for up and download rates in the TCP/uTP mixed mode algorithm
This commit is contained in:
parent
8aed4eaa7f
commit
744a3be65d
|
@ -2711,6 +2711,8 @@ namespace aux {
|
||||||
|
|
||||||
bandwidth_channel* tcp_channel[] = { &m_tcp_upload_channel, &m_tcp_download_channel };
|
bandwidth_channel* tcp_channel[] = { &m_tcp_upload_channel, &m_tcp_download_channel };
|
||||||
int stat_rate[] = {m_stat.upload_rate(), m_stat.download_rate() };
|
int stat_rate[] = {m_stat.upload_rate(), m_stat.download_rate() };
|
||||||
|
// never throttle below this
|
||||||
|
int lower_limit[] = {5000, 30000};
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
|
@ -2725,7 +2727,7 @@ namespace aux {
|
||||||
int total_peers = num_peers[0][i] + num_peers[1][i];
|
int total_peers = num_peers[0][i] + num_peers[1][i];
|
||||||
// this are 64 bits since it's multiplied by the number
|
// this are 64 bits since it's multiplied by the number
|
||||||
// of peers, which otherwise might overflow an int
|
// of peers, which otherwise might overflow an int
|
||||||
boost::uint64_t rate = (std::max)(stat_rate[i], 20000);
|
boost::uint64_t rate = (std::max)(stat_rate[i], lower_limit[i]);
|
||||||
tcp_channel[i]->throttle(int(rate * num_peers[0][i] / total_peers));
|
tcp_channel[i]->throttle(int(rate * num_peers[0][i] / total_peers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue