diff --git a/deluge/core/core.py b/deluge/core/core.py index 5fb7acad0..38b96559d 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -85,6 +85,9 @@ DEFAULT_PREFS = { "max_upload_speed": -1.0, "max_download_speed": -1.0, "max_upload_slots_global": -1, + "max_half_open_connections": -1, + "max_connections_per_second": -1, + "ignore_limits_on_local_network": True, "max_connections_per_torrent": -1, "max_upload_slots_per_torrent": -1, "max_upload_speed_per_torrent": -1, @@ -252,6 +255,12 @@ class Core( self._on_set_max_download_speed) self.config.register_set_function("max_upload_slots_global", self._on_set_max_upload_slots_global) + self.config.register_set_function("max_half_open_connections", + self._on_set_max_half_open_connections) + self.config.register_set_function("max_connections_per_second", + self._on_set_max_connections_per_second) + self.config.register_set_function("ignore_limits_on_local_network", + self._on_ignore_limits_on_local_network) self.config.register_set_function("share_ratio_limit", self._on_set_share_ratio_limit) self.config.register_set_function("seed_time_ratio_limit", @@ -811,6 +820,17 @@ class Core( log.debug("max_upload_slots_global set to %s..", value) self.session.set_max_uploads(value) + def _on_set_max_half_open_connections(self, key, value): + self.session.set_max_half_open_connections(value) + + def _on_set_max_connections_per_second(self, key, value): + self.settings.connection_speed = value + self.session.set_settings(self.settings) + + def _on_ignore_limits_on_local_network(self, key, value): + self.settings.ignore_limits_on_local_network = value + self.session.set_settings(self.settings) + def _on_set_share_ratio_limit(self, key, value): log.debug("%s set to %s..", key, value) self.settings.share_ratio_limit = value diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade index 01c7cf4be..cd174399a 100644 --- a/deluge/ui/gtkui/glade/preferences_dialog.glade +++ b/deluge/ui/gtkui/glade/preferences_dialog.glade @@ -1,6 +1,6 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -1155,137 +1155,218 @@ Disabled 2 12 - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 2 - 15 + 5 - + True - True - The maximum upload slots for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - 1 - True - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - The maximum download speed for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - 1 - True + 6 + 2 + 15 + + + True + True + The maximum upload slots for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + True + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + 1 + True + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The maximum download speed for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + 1 + True + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + The maximum download speed for all torrents. Set -1 for unlimited. + 0 + Maximum Download Speed (KiB/s): + + + 2 + 3 + GTK_FILL + + + + + True + True + The maximum number of connections allowed. Set -1 for unlimited. + 4 + 1 + -1 -1 9000 1 10 10 + 1 + True + True + GTK_UPDATE_IF_VALID + + + 1 + 2 + GTK_FILL + + + + + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 0 + Maximum Upload Slots: + + + 1 + 2 + GTK_FILL + + + + + True + The maximum number of connections allowed. Set -1 for unlimited. + 0 + Maximum Connections: + + + GTK_FILL + + + + + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 0 + Maximum Upload Speed (KiB/s): + + + 3 + 4 + GTK_FILL + + + + + True + 0 + Maximum Half-Open Connections: + + + 4 + 5 + GTK_FILL + + + + + True + 0 + Maximum Connection Attempts per Second: + + + 5 + 6 + GTK_FILL + + + + + True + True + 1 + -1 -1 9999 1 10 10 + True + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + True + True + 1 + -1 -1 9999 1 10 10 + True + + + 1 + 2 + 5 + 6 + GTK_FILL + + - - 1 - 2 - 2 - 3 - GTK_FILL - - + True - The maximum download speed for all torrents. Set -1 for unlimited. - 0 - Maximum Download Speed (KiB/s): + 5 + + + True + True + Ignore limits on local network + 0 + True + True + + - 2 - 3 - GTK_FILL - - - - - True - True - The maximum number of connections allowed. Set -1 for unlimited. - 4 - 1 - -1 -1 9000 1 10 10 - 1 - True - True - GTK_UPDATE_IF_VALID - - - 1 - 2 - GTK_FILL - - - - - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 0 - Maximum Upload Slots: - - - 1 - 2 - GTK_FILL - - - - - True - The maximum number of connections allowed. Set -1 for unlimited. - 0 - Maximum Connections: - - - GTK_FILL - - - - - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 0 - Maximum Upload Speed (KiB/s): - - - 3 - 4 - GTK_FILL + 1 @@ -1331,85 +1412,18 @@ Disabled 2 15 - - True - True - The maximum upload slots per torrent. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - + True True The maximum number of connections per torrent. Set -1 for unlimited. 1 -1 -1 9000 1 10 10 - True + 1 True 1 2 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Connections: - - - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Upload Slots: - - - 1 - 2 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Download Speed (KiB/s): - - - 2 - 3 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Upload Speed (KiB/s): - - 3 4 GTK_FILL @@ -1434,20 +1448,87 @@ Disabled - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Upload Speed (KiB/s): + + + 3 + 4 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Download Speed (KiB/s): + + + 2 + 3 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Upload Slots: + + + 1 + 2 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Connections: + + + GTK_FILL + + + + True True The maximum number of connections per torrent. Set -1 for unlimited. 1 -1 -1 9000 1 10 10 - 1 + True True 1 2 - 3 - 4 + GTK_FILL + + + + + True + True + The maximum upload slots per torrent. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + True + True + + + 1 + 2 + 1 + 2 GTK_FILL @@ -2261,59 +2342,15 @@ Disabled 2 10 - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 0 -1 9999 1 10 10 - True - True - - - 1 - 2 - - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 0 -1 9999 1 10 10 - True - True - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - Total active seeding: - - - 2 - 3 - GTK_FILL - - - - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 - Total active: + Total active downloading: + 1 + 2 GTK_FILL @@ -2336,18 +2373,62 @@ Disabled - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 - Total active downloading: + Total active: - 1 - 2 GTK_FILL + + + True + 0 + Total active seeding: + + + 2 + 3 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + 0 -1 9999 1 10 10 + True + True + + + 1 + 2 + 2 + 3 + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + 0 -1 9999 1 10 10 + True + True + + + 1 + 2 + + + @@ -2408,51 +2489,18 @@ Disabled 2 10 - - True - 0 - Share Ratio Limit: - - - GTK_FILL - - - - - True - 0 - Seed Time Ratio: - - - 1 - 2 - GTK_FILL - - - - - True - 0 - Seed Time (m): - - - 2 - 3 - GTK_FILL - - - - + True True 6 1 - 1.5 -1 100 0.10000000000000001 10 10 - 2 + 6 -1 100 1 10 10 1 2 + 2 + 3 @@ -2474,19 +2522,52 @@ Disabled - + True True 6 1 - 6 -1 100 1 10 10 + 1.5 -1 100 0.10000000000000001 10 10 + 2 1 2 + + + + + + True + 0 + Seed Time (m): + + 2 3 - + GTK_FILL + + + + + True + 0 + Seed Time Ratio: + + + 1 + 2 + GTK_FILL + + + + + True + 0 + Share Ratio Limit: + + + GTK_FILL diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 7f76c28e5..0dffb1e0b 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -233,6 +233,12 @@ class Preferences(component.Component): ("value", self.core_config["max_upload_speed"]), "spin_max_upload_slots_global": \ ("value", self.core_config["max_upload_slots_global"]), + "spin_max_half_open_connections": \ + ("value", self.core_config["max_half_open_connections"]), + "spin_max_connections_per_second": \ + ("value", self.core_config["max_connections_per_second"]), + "chk_ignore_limits_on_local_network": \ + ("active", self.core_config["ignore_limits_on_local_network"]), "spin_max_connections_per_torrent": \ ("value", self.core_config["max_connections_per_torrent"]), "spin_max_upload_slots_per_torrent": \ @@ -350,6 +356,9 @@ class Preferences(component.Component): "spin_max_download", "spin_max_upload", "spin_max_upload_slots_global", + "spin_max_half_open_connections", + "spin_max_connections_per_second", + "chk_ignore_limits_on_local_network", "spin_max_connections_per_torrent", "spin_max_upload_slots_per_torrent", "spin_max_download_per_torrent", @@ -504,6 +513,11 @@ class Preferences(component.Component): new_core_config["max_upload_slots_global"] = \ self.glade.get_widget( "spin_max_upload_slots_global").get_value_as_int() + new_core_config["max_half_open_connections"] = \ + self.glade.get_widget("spin_max_half_open_connections").get_value_as_int() + new_core_config["max_connections_per_second"] = \ + self.glade.get_widget( + "spin_max_connections_per_second").get_value_as_int() new_core_config["max_connections_per_torrent"] = \ self.glade.get_widget( "spin_max_connections_per_torrent").get_value_as_int() @@ -516,6 +530,8 @@ class Preferences(component.Component): new_core_config["max_download_speed_per_torrent"] = \ self.glade.get_widget( "spin_max_download_per_torrent").get_value() + new_core_config["ignore_limits_on_local_network"] = \ + self.glade.get_widget("chk_ignore_limits_on_local_network").get_active() ## Interface tab ## new_gtkui_config["enable_system_tray"] = \