Ticket #2257: active_X_limit.diff

File active_X_limit.diff, 2.6 KB (added by Chionsas, 8 years ago)

Allow setting of active_dht_limit, active_tracker_limit and active_lsd_limit.

  • deluge/core/preferencesmanager.py

    diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py
    index 7a3cc2c..bca8356 100644
    a b  
    9191    "max_active_seeding": 5, 
    9292    "max_active_downloading": 3, 
    9393    "max_active_limit": 8, 
     94    "max_active_dht_limit": -1, 
     95    "max_active_tracker_limit": -1, 
     96    "max_active_lsd_limit": -1, 
    9497    "dont_count_slow_torrents": False, 
    9598    "queue_new_to_top": False, 
    9699    "stop_seed_at_ratio": False, 
    def start(self): 
    207210            self._on_set_max_active_seeding) 
    208211        self.config.register_set_function("max_active_limit", 
    209212            self._on_set_max_active_limit) 
     213        self.config.register_set_function("max_active_dht_limit", 
     214            self._on_set_max_active_dht_limit) 
     215        self.config.register_set_function("max_active_tracker_limit", 
     216            self._on_set_max_active_tracker_limit) 
     217        self.config.register_set_function("max_active_lsd_limit", 
     218            self._on_set_max_active_lsd_limit) 
    210219        self.config.register_set_function("dont_count_slow_torrents", 
    211220            self._on_set_dont_count_slow_torrents) 
    212221        self.config.register_set_function("send_info", 
    def _on_set_max_active_limit(self, key, value): 
    421430        log.debug("%s set to %s..", key, value) 
    422431        self.session_set_setting("active_limit", value) 
    423432 
     433    def _on_set_max_active_dht_limit(self, key, value): 
     434        log.debug("%s set to %s..", key, value) 
     435        # libtorrent does not accept -1 for active_dht_limit, 
     436        # so max(32-bit signed int) is passed for unlimited 
     437        if (value == -1): 
     438            value = 2147483647 
     439        self.session_set_setting("active_dht_limit", value) 
     440 
     441    def _on_set_max_active_tracker_limit(self, key, value): 
     442        log.debug("%s set to %s..", key, value) 
     443        # libtorrent does not accept -1 for active_tracker_limit, 
     444        # so max(32-bit signed int) is passed for unlimited 
     445        if (value == -1): 
     446            value = 2147483647 
     447        self.session_set_setting("active_tracker_limit", value) 
     448 
     449    def _on_set_max_active_lsd_limit(self, key, value): 
     450        log.debug("%s set to %s..", key, value) 
     451        # libtorrent does not accept -1 for active_lsd_limit, 
     452        # so max(32-bit signed int) is passed for unlimited 
     453        if (value == -1): 
     454            value = 2147483647 
     455        self.session_set_setting("active_lsd_limit", value) 
     456 
    424457    def _on_set_dont_count_slow_torrents(self, key, value): 
    425458        log.debug("%s set to %s..", key, value) 
    426459        self.session_set_setting("dont_count_slow_torrents", value)