mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-13 12:46:18 +00:00
Stop at max_active in scheduler.simple.removed
The limit was checked once, then every download was resumed.
This commit is contained in:
@@ -28,9 +28,10 @@ cmd_scheduler_simple_removed(core::Download* download) {
|
|||||||
control->core()->download_list()->pause(download);
|
control->core()->download_list()->pause(download);
|
||||||
|
|
||||||
core::View* viewActive = *control->view_manager()->find("active");
|
core::View* viewActive = *control->view_manager()->find("active");
|
||||||
|
unsigned int numActive = viewActive->size_visible();
|
||||||
int64_t maxActive = rpc::call_command("scheduler.max_active", torrent::Object()).as_value();
|
int64_t maxActive = rpc::call_command("scheduler.max_active", torrent::Object()).as_value();
|
||||||
|
|
||||||
if ((int64_t)viewActive->size_visible() >= maxActive)
|
if ((int64_t)numActive >= maxActive)
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
|
|
||||||
// The 'started' view contains all the views we may choose amongst.
|
// The 'started' view contains all the views we may choose amongst.
|
||||||
@@ -41,6 +42,9 @@ cmd_scheduler_simple_removed(core::Download* download) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
control->core()->download_list()->resume(*itr);
|
control->core()->download_list()->resume(*itr);
|
||||||
|
|
||||||
|
if ((int64_t)++numActive >= maxActive)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
|
|||||||
Reference in New Issue
Block a user