1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Remove artificial max limits from "Torrent Queueing" related options

Closes #16936.

PR #16942.
This commit is contained in:
Chocobo1 2022-04-30 12:26:18 +08:00 committed by GitHub
parent c5ea6b0502
commit 19cbffb5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 18 deletions

View File

@ -1191,13 +1191,18 @@ void Session::processBannedIPs(lt::ip_filter &filter)
void Session::adjustLimits(lt::settings_pack &settingsPack) const void Session::adjustLimits(lt::settings_pack &settingsPack) const
{ {
// Internally increase the queue limits to ensure that the magnet is started // Internally increase the queue limits to ensure that the magnet is started
const int maxDownloads = maxActiveDownloads(); const auto adjustLimit = [this](const int limit) -> int
const int maxActive = maxActiveTorrents(); {
if (limit <= -1)
return limit;
// check for overflow: (limit + m_extraLimit) < std::numeric_limits<int>::max()
return (m_extraLimit < (std::numeric_limits<int>::max() - limit))
? (limit + m_extraLimit)
: std::numeric_limits<int>::max();
};
settingsPack.set_int(lt::settings_pack::active_downloads settingsPack.set_int(lt::settings_pack::active_downloads, adjustLimit(maxActiveDownloads()));
, maxDownloads > -1 ? maxDownloads + m_extraLimit : maxDownloads); settingsPack.set_int(lt::settings_pack::active_limit, adjustLimit(maxActiveTorrents()));
settingsPack.set_int(lt::settings_pack::active_limit
, maxActive > -1 ? maxActive + m_extraLimit : maxActive);
} }
void Session::applyBandwidthLimits(lt::settings_pack &settingsPack) const void Session::applyBandwidthLimits(lt::settings_pack &settingsPack) const

View File

@ -2442,10 +2442,7 @@ Disable encryption: Only connect to peers without protocol encryption</string>
<number>-1</number> <number>-1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>999</number> <number>2147483647</number>
</property>
<property name="value">
<number>3</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -2465,10 +2462,7 @@ Disable encryption: Only connect to peers without protocol encryption</string>
<number>-1</number> <number>-1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>999</number> <number>2147483647</number>
</property>
<property name="value">
<number>3</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -2488,10 +2482,7 @@ Disable encryption: Only connect to peers without protocol encryption</string>
<number>-1</number> <number>-1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>999</number> <number>2147483647</number>
</property>
<property name="value">
<number>5</number>
</property> </property>
</widget> </widget>
</item> </item>