From ef3b22691bf7c7f24b978f42e2f901cce1914abd Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Fri, 5 Jun 2009 02:10:41 +0000 Subject: [PATCH] Apply the global bandwidth settings on plugin disable to prevent slow limits from staying in effect. --- deluge/plugins/scheduler/scheduler/core.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/deluge/plugins/scheduler/scheduler/core.py b/deluge/plugins/scheduler/scheduler/core.py index ad0f5fc25..54b4cc66a 100644 --- a/deluge/plugins/scheduler/scheduler/core.py +++ b/deluge/plugins/scheduler/scheduler/core.py @@ -96,10 +96,23 @@ class Core(CorePluginBase): except: pass + self.__apply_set_functions() + def update(self): pass + def __apply_set_functions(self): + """ + Have the core apply it's bandwidth settings as specified in core.conf. + """ + core_config = deluge.configmanager.ConfigManager("core.conf") + core_config.apply_set_functions("max_download_speed") + core_config.apply_set_functions("max_upload_speed") + core_config.apply_set_functions("max_active_limit") + # Resume the session if necessary + component.get("Core").session.resume() + def do_schedule(self, timer=True): """ This is where we apply schedule rules. @@ -110,12 +123,7 @@ class Core(CorePluginBase): if state == "Green": # This is Green (Normal) so we just make sure we've applied the # global defaults - core_config = deluge.configmanager.ConfigManager("core.conf") - core_config.apply_set_functions("max_download_speed") - core_config.apply_set_functions("max_upload_speed") - core_config.apply_set_functions("max_active_limit") - # Resume the session if necessary - component.get("Core").session.resume() + self.__apply_set_functions() elif state == "Yellow": # This is Yellow (Slow), so use the settings provided from the user session = component.get("Core").session