diff --git a/ChangeLog b/ChangeLog index 8886da969..0c88937f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ Deluge 1.0.6 (In Development) Core: * Fix #475 catch unicode decoding errors + * Add an option to not include IP overhead in rate limiting (this is equivalent + to how 0.5.x behaves) GtkUI: * Display the proper downloaded value in the statistics tab diff --git a/deluge/core/core.py b/deluge/core/core.py index 1f6990bcc..b614d2a6c 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -116,6 +116,7 @@ DEFAULT_PREFS = { "move_completed": False, "move_completed_path": deluge.common.get_default_download_dir(), "new_release_check": True, + "rate_limit_ip_overhead": True } class Core( @@ -292,6 +293,8 @@ class Core( self.new_release_timer = None self.config.register_set_function("new_release_check", self._on_new_release_check) + self.config.register_set_function("rate_limit_ip_overhead", + self._on_rate_limit_ip_overhead) self.config.register_change_callback(self._on_config_value_change) # Start the AlertManager @@ -476,7 +479,8 @@ class Core( # Build the status dictionary try: status = self.torrents[torrent_id].get_status(keys) - except KeyError: + except KeyError, e: + log.debug(e) # The torrent_id is not found in the torrentmanager, so return None return None @@ -493,7 +497,8 @@ class Core( for torrent_id in torrent_ids: try: status = self.torrents[torrent_id].get_status(keys) - except KeyError: + except KeyError, e: + log.debug(e) return None # Get the leftover fields and ask the plugin manager to fill them leftover_fields = list(set(keys) - set(status.keys())) @@ -949,3 +954,8 @@ class Core( else: if self.new_release_timer: gobject.source.remove(self.new_release_timer) + + def _on_rate_limit_ip_overhead(self, key, value): + log.debug("%s: %s", key, value) + self.settings.rate_limit_ip_overhead = value + self.session.set_settings(self.settings) diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade index 39ae92cae..0abba9c34 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 @@ -1166,40 +1166,127 @@ Disabled 2 15 - + True True - The maximum upload slots for all torrents. Set -1 for unlimited. 1 - -1 -1 9000 1 10 10 - 1 - True + -1 -1 9999 1 10 10 True 1 2 + 5 + 6 + GTK_FILL + + + + + True + True + 1 + -1 -1 9999 1 10 10 + True + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + True + 0 + Maximum Connection Attempts per Second: + + + 5 + 6 + GTK_FILL + + + + + True + 0 + Maximum Half-Open Connections: + + + 4 + 5 + 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 + 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 Slots: + + 1 2 GTK_FILL - + True True - The maximum upload speed for all torrents. Set -1 for unlimited. + The maximum number of connections allowed. Set -1 for unlimited. + 4 1 -1 -1 9000 1 10 10 1 - 1 + True True + GTK_UPDATE_IF_VALID 1 2 - 3 - 4 + GTK_FILL + + + + + True + The maximum download speed for all torrents. Set -1 for unlimited. + 0 + Maximum Download Speed (KiB/s): + + + 2 + 3 GTK_FILL @@ -1224,127 +1311,40 @@ Disabled - - 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 + The maximum upload speed for all torrents. Set -1 for unlimited. 1 -1 -1 9000 1 10 10 1 - True + 1 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 + The maximum upload slots for all torrents. Set -1 for unlimited. 1 - -1 -1 9999 1 10 10 + -1 -1 9000 1 10 10 + 1 + True True 1 2 - 4 - 5 - GTK_FILL - - - - - True - True - 1 - -1 -1 9999 1 10 10 - True - - - 1 - 2 - 5 - 6 + 1 + 2 GTK_FILL @@ -1369,6 +1369,26 @@ Disabled 1 + + + True + 5 + + + True + True + If checked, the estimated TCP/IP overhead is drained from the rate limiters, to avoid exceeding the limits with the total traffic + Rate limit IP overhead + 0 + True + True + + + + + 2 + + @@ -1412,18 +1432,85 @@ Disabled 2 15 - + True True - The maximum number of connections per torrent. Set -1 for unlimited. + The maximum upload slots per torrent. Set -1 for unlimited. 1 -1 -1 9000 1 10 10 - 1 + 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 + 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 @@ -1448,87 +1535,20 @@ 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 - True + 1 True 1 2 - 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 + 3 + 4 GTK_FILL @@ -2343,15 +2363,59 @@ 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 downloading: + Total active: - 1 - 2 GTK_FILL @@ -2374,62 +2438,18 @@ Disabled - + 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 - - - 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 - - - @@ -2490,18 +2510,51 @@ 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 - 6 -1 100 1 10 10 + 1.5 -1 100 0.10000000000000001 10 10 + 2 1 2 - 2 - 3 @@ -2523,52 +2576,19 @@ Disabled - + True True 6 1 - 1.5 -1 100 0.10000000000000001 10 10 - 2 + 6 -1 100 1 10 10 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 + @@ -2731,7 +2751,6 @@ Disabled True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True False diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 19d54b05f..96ec1beb9 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -239,6 +239,8 @@ class Preferences(component.Component): ("value", self.core_config["max_connections_per_second"]), "chk_ignore_limits_on_local_network": \ ("active", self.core_config["ignore_limits_on_local_network"]), + "chk_rate_limit_ip_overhead": \ + ("active", self.core_config["rate_limit_ip_overhead"]), "spin_max_connections_per_torrent": \ ("value", self.core_config["max_connections_per_torrent"]), "spin_max_upload_slots_per_torrent": \ @@ -359,6 +361,7 @@ class Preferences(component.Component): "spin_max_half_open_connections", "spin_max_connections_per_second", "chk_ignore_limits_on_local_network", + "chk_rate_limit_ip_overhead", "spin_max_connections_per_torrent", "spin_max_upload_slots_per_torrent", "spin_max_download_per_torrent", @@ -532,6 +535,8 @@ class Preferences(component.Component): "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() + new_core_config["rate_limit_ip_overhead"] = \ + self.glade.get_widget("chk_rate_limit_ip_overhead").get_active() ## Interface tab ## new_gtkui_config["enable_system_tray"] = \ @@ -706,4 +711,3 @@ class Preferences(component.Component): def on_plugin_selection_changed(self, treeselection): log.debug("on_plugin_selection_changed") - diff --git a/libtorrent/bindings/python/src/session_settings.cpp b/libtorrent/bindings/python/src/session_settings.cpp index 3f2a7b632..76e078560 100755 --- a/libtorrent/bindings/python/src/session_settings.cpp +++ b/libtorrent/bindings/python/src/session_settings.cpp @@ -44,11 +44,12 @@ void bind_session_settings() .def_readwrite("seed_time_limit", &session_settings::seed_time_limit) .def_readwrite("auto_scraped_interval", &session_settings::auto_scrape_interval) .def_readwrite("peer_tos", &session_settings::peer_tos) + .def_readwrite("rate_limit_ip_overhead", &session_settings::rate_limit_ip_overhead) #ifndef TORRENT_DISABLE_DHT .def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback) #endif ; - + enum_("proxy_type") .value("none", proxy_settings::none) .value("socks4", proxy_settings::socks4) @@ -57,7 +58,7 @@ void bind_session_settings() .value("http", proxy_settings::http) .value("http_pw", proxy_settings::http_pw) ; - class_("proxy_settings") + class_("proxy_settings") .def_readwrite("hostname", &proxy_settings::hostname) .def_readwrite("port", &proxy_settings::port) .def_readwrite("password", &proxy_settings::password) @@ -71,11 +72,11 @@ void bind_session_settings() .value("enabled", pe_settings::enabled) .value("disabled", pe_settings::disabled) ; - + enum_("enc_level") .value("rc4", pe_settings::rc4) .value("plaintext", pe_settings::plaintext) - .value("both", pe_settings::both) + .value("both", pe_settings::both) ; class_("pe_settings") @@ -87,5 +88,3 @@ void bind_session_settings() #endif } - -