diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index a06ebd9b..36ba7a89 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -486,6 +486,7 @@ initialize_variables() { variables->insert("min_peers_seed", new utils::VariableValue(-1)); variables->insert("max_peers_seed", new utils::VariableValue(-1)); variables->insert("max_uploads", new utils::VariableValue(15)); + variables->insert("max_uploads_div", new utils::VariableValue(1)); variables->insert("max_chunks_queued", new utils::VariableValue(0)); variables->insert("download_rate", new utils::VariableValueSlot(rak::ptr_fn(&torrent::down_throttle), rak::mem_fn(control->ui(), &ui::Root::set_down_throttle_i64), diff --git a/src/ui/root.cc b/src/ui/root.cc index e93ca604..c1db80f5 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -171,12 +171,15 @@ Root::set_up_throttle(unsigned int throttle) { torrent::set_up_throttle(throttle * 1024); - if (throttle == 0) + if (throttle == 0) { torrent::set_max_unchoked(0); + return; + } - else if (throttle <= 10) + throttle /= control->variable()->get_value("max_uploads_div"); + + if (throttle <= 10) torrent::set_max_unchoked(1 + throttle / 1); - else torrent::set_max_unchoked(10 + throttle / 5); }