Add an option to not include IP overhead in rate limiting (setting False

is equivalent to how 0.5.x behaves)
This commit is contained in:
Andrew Resch 2008-11-22 09:00:01 +00:00
parent 4bfd5646ad
commit 3dbd3a3fd3
4 changed files with 733 additions and 701 deletions

View File

@ -107,6 +107,7 @@ DEFAULT_PREFS = {
"outgoing_ports": [0, 0], "outgoing_ports": [0, 0],
"random_outgoing_ports": True, "random_outgoing_ports": True,
"peer_tos": "0x00", "peer_tos": "0x00",
"rate_limit_ip_overhead": True
} }
class PreferencesManager(component.Component): class PreferencesManager(component.Component):
@ -192,6 +193,8 @@ class PreferencesManager(component.Component):
self.new_release_timer = None self.new_release_timer = None
self.config.register_set_function("new_release_check", self.config.register_set_function("new_release_check",
self._on_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) self.config.register_change_callback(self._on_config_value_change)
@ -454,3 +457,8 @@ class PreferencesManager(component.Component):
self.session.set_web_seed_proxy(proxy_settings) self.session.set_web_seed_proxy(proxy_settings)
self.session.set_tracker_proxy(proxy_settings) self.session.set_tracker_proxy(proxy_settings)
self.session.set_dht_proxy(proxy_settings) self.session.set_dht_proxy(proxy_settings)
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)

File diff suppressed because it is too large Load Diff

View File

@ -246,6 +246,8 @@ class Preferences(component.Component):
("value", self.core_config["max_connections_per_second"]), ("value", self.core_config["max_connections_per_second"]),
"chk_ignore_limits_on_local_network": \ "chk_ignore_limits_on_local_network": \
("active", self.core_config["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": \ "spin_max_connections_per_torrent": \
("value", self.core_config["max_connections_per_torrent"]), ("value", self.core_config["max_connections_per_torrent"]),
"spin_max_upload_slots_per_torrent": \ "spin_max_upload_slots_per_torrent": \
@ -375,6 +377,7 @@ class Preferences(component.Component):
"spin_max_half_open_connections", "spin_max_half_open_connections",
"spin_max_connections_per_second", "spin_max_connections_per_second",
"chk_ignore_limits_on_local_network", "chk_ignore_limits_on_local_network",
"chk_rate_limit_ip_overhead",
"spin_max_connections_per_torrent", "spin_max_connections_per_torrent",
"spin_max_upload_slots_per_torrent", "spin_max_upload_slots_per_torrent",
"spin_max_download_per_torrent", "spin_max_download_per_torrent",
@ -589,6 +592,8 @@ class Preferences(component.Component):
"spin_max_download_per_torrent").get_value() "spin_max_download_per_torrent").get_value()
new_core_config["ignore_limits_on_local_network"] = \ new_core_config["ignore_limits_on_local_network"] = \
self.glade.get_widget("chk_ignore_limits_on_local_network").get_active() 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 ## ## Interface tab ##
new_gtkui_config["enable_system_tray"] = \ new_gtkui_config["enable_system_tray"] = \

View File

@ -44,11 +44,12 @@ void bind_session_settings()
.def_readwrite("seed_time_limit", &session_settings::seed_time_limit) .def_readwrite("seed_time_limit", &session_settings::seed_time_limit)
.def_readwrite("auto_scraped_interval", &session_settings::auto_scrape_interval) .def_readwrite("auto_scraped_interval", &session_settings::auto_scrape_interval)
.def_readwrite("peer_tos", &session_settings::peer_tos) .def_readwrite("peer_tos", &session_settings::peer_tos)
.def_readwrite("rate_limit_ip_overhead", &session_settings::rate_limit_ip_overhead)
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
.def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback) .def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback)
#endif #endif
; ;
enum_<proxy_settings::proxy_type>("proxy_type") enum_<proxy_settings::proxy_type>("proxy_type")
.value("none", proxy_settings::none) .value("none", proxy_settings::none)
.value("socks4", proxy_settings::socks4) .value("socks4", proxy_settings::socks4)
@ -57,7 +58,7 @@ void bind_session_settings()
.value("http", proxy_settings::http) .value("http", proxy_settings::http)
.value("http_pw", proxy_settings::http_pw) .value("http_pw", proxy_settings::http_pw)
; ;
class_<proxy_settings>("proxy_settings") class_<proxy_settings>("proxy_settings")
.def_readwrite("hostname", &proxy_settings::hostname) .def_readwrite("hostname", &proxy_settings::hostname)
.def_readwrite("port", &proxy_settings::port) .def_readwrite("port", &proxy_settings::port)
.def_readwrite("password", &proxy_settings::password) .def_readwrite("password", &proxy_settings::password)
@ -71,11 +72,11 @@ void bind_session_settings()
.value("enabled", pe_settings::enabled) .value("enabled", pe_settings::enabled)
.value("disabled", pe_settings::disabled) .value("disabled", pe_settings::disabled)
; ;
enum_<pe_settings::enc_level>("enc_level") enum_<pe_settings::enc_level>("enc_level")
.value("rc4", pe_settings::rc4) .value("rc4", pe_settings::rc4)
.value("plaintext", pe_settings::plaintext) .value("plaintext", pe_settings::plaintext)
.value("both", pe_settings::both) .value("both", pe_settings::both)
; ;
class_<pe_settings>("pe_settings") class_<pe_settings>("pe_settings")
@ -87,5 +88,3 @@ void bind_session_settings()
#endif #endif
} }