Implement #296 ability to change peer TOS byte
This commit is contained in:
parent
af98a45606
commit
5706b80cb2
|
@ -1,4 +1,4 @@
|
||||||
Deluge 1.1.0 - "" (In Development)
|
Deluge 1.1.0 - "" (In Development)
|
||||||
Core:
|
Core:
|
||||||
* Implement #79 ability to change outgoing port range
|
* Implement #79 ability to change outgoing port range
|
||||||
|
* Implement #296 ability to change peer TOS byte
|
||||||
|
|
|
@ -117,7 +117,8 @@ DEFAULT_PREFS = {
|
||||||
"proxy_password" : "",
|
"proxy_password" : "",
|
||||||
"proxy_port": 8080,
|
"proxy_port": 8080,
|
||||||
"outgoing_ports": [0, 0],
|
"outgoing_ports": [0, 0],
|
||||||
"random_outgoing_ports": True
|
"random_outgoing_ports": True,
|
||||||
|
"peer_tos": "0x00",
|
||||||
}
|
}
|
||||||
|
|
||||||
class Core(
|
class Core(
|
||||||
|
@ -239,6 +240,8 @@ class Core(
|
||||||
self._on_set_outgoing_ports)
|
self._on_set_outgoing_ports)
|
||||||
self.config.register_set_function("random_outgoing_ports",
|
self.config.register_set_function("random_outgoing_ports",
|
||||||
self._on_set_random_outgoing_ports)
|
self._on_set_random_outgoing_ports)
|
||||||
|
self.config.register_set_function("peer_tos",
|
||||||
|
self._on_set_peer_tos)
|
||||||
self.config.register_set_function("dht", self._on_set_dht)
|
self.config.register_set_function("dht", self._on_set_dht)
|
||||||
self.config.register_set_function("upnp", self._on_set_upnp)
|
self.config.register_set_function("upnp", self._on_set_upnp)
|
||||||
self.config.register_set_function("natpmp", self._on_set_natpmp)
|
self.config.register_set_function("natpmp", self._on_set_natpmp)
|
||||||
|
@ -773,6 +776,16 @@ class Core(
|
||||||
if value:
|
if value:
|
||||||
self.session.outgoing_ports(0, 0)
|
self.session.outgoing_ports(0, 0)
|
||||||
|
|
||||||
|
def _on_set_peer_tos(self, key, value):
|
||||||
|
log.debug("setting peer_tos to: %s", value)
|
||||||
|
try:
|
||||||
|
self.settings.peer_tos = str(int(value, 16))
|
||||||
|
except ValueError, e:
|
||||||
|
log.debug("Invalid tos byte: %s", e)
|
||||||
|
return
|
||||||
|
|
||||||
|
self.session.set_settings(self.settings)
|
||||||
|
|
||||||
def _on_set_dht(self, key, value):
|
def _on_set_dht(self, key, value):
|
||||||
log.debug("dht value set to %s", value)
|
log.debug("dht value set to %s", value)
|
||||||
state_file = deluge.common.get_default_config_dir('dht.state')
|
state_file = deluge.common.get_default_config_dir('dht.state')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
<!--Generated with glade3 3.4.5 on Tue Jul 29 22:44:03 2008 -->
|
<!--Generated with glade3 3.4.5 on Tue Jul 29 23:05:23 2008 -->
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
<widget class="GtkDialog" id="pref_dialog">
|
<widget class="GtkDialog" id="pref_dialog">
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
@ -913,14 +913,33 @@
|
||||||
<widget class="GtkVBox" id="vbox4">
|
<widget class="GtkVBox" id="vbox4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="chk_dht">
|
<widget class="GtkHBox" id="hbox4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="spacing">5</property>
|
||||||
<property name="tooltip" translatable="yes">Distributed hash table may improve the amount of active connections.</property>
|
<child>
|
||||||
<property name="label" translatable="yes">Enable Mainline DHT</property>
|
<widget class="GtkLabel" id="label80">
|
||||||
<property name="use_underline">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="response_id">0</property>
|
<property name="tooltip" translatable="yes">The TOS byte set in the IP header of every packet sent to peers (including web seeds). Expects a Hex value.</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="label" translatable="yes">Peer TOS Byte:</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="entry_peer_tos">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="width_chars">4</property>
|
||||||
|
<property name="text" translatable="yes">0x00</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -930,7 +949,7 @@
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label5">
|
<widget class="GtkLabel" id="label5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"><b>DHT</b></property>
|
<property name="label" translatable="yes"><b>TOS</b></property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -956,9 +975,14 @@
|
||||||
<property name="bottom_padding">2</property>
|
<property name="bottom_padding">2</property>
|
||||||
<property name="left_padding">12</property>
|
<property name="left_padding">12</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox4">
|
<widget class="GtkTable" id="table8">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="spacing">10</property>
|
<property name="n_rows">2</property>
|
||||||
|
<property name="n_columns">3</property>
|
||||||
|
<property name="column_spacing">5</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="chk_upnp">
|
<widget class="GtkCheckButton" id="chk_upnp">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -971,8 +995,7 @@
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="padding">2</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -987,9 +1010,9 @@
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="padding">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="position">1</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1004,9 +1027,9 @@
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="padding">2</property>
|
<property name="right_attach">3</property>
|
||||||
<property name="position">2</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1020,9 +1043,27 @@
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="top_attach">1</property>
|
||||||
<property name="fill">False</property>
|
<property name="bottom_attach">2</property>
|
||||||
<property name="position">3</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCheckButton" id="chk_dht">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Distributed hash table may improve the amount of active connections.</property>
|
||||||
|
<property name="label" translatable="yes">DHT</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="response_id">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1893,7 +1934,7 @@ Disabled</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="tooltip" translatable="yes">Classic Mode will hide most of the daemon functionality and will make Deluge appear to be a single application. Use this if you do not want to take advantage of running Deluge as a daemon.</property>
|
<property name="tooltip" translatable="yes">Classic Mode will hide most of the daemon functionality and will make Deluge appear to be a single application. Use this if you do not want to take advantage of running Deluge as a daemon. You need to restart Deluge for this setting to take effect.</property>
|
||||||
<property name="label" translatable="yes">Enable</property>
|
<property name="label" translatable="yes">Enable</property>
|
||||||
<property name="response_id">0</property>
|
<property name="response_id">0</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
|
|
|
@ -217,6 +217,7 @@ class Preferences(component.Component):
|
||||||
"spin_outgoing_port_min": ("value", self.core_config["outgoing_ports"][0]),
|
"spin_outgoing_port_min": ("value", self.core_config["outgoing_ports"][0]),
|
||||||
"spin_outgoing_port_max": ("value", self.core_config["outgoing_ports"][1]),
|
"spin_outgoing_port_max": ("value", self.core_config["outgoing_ports"][1]),
|
||||||
"chk_random_outgoing_ports": ("active", self.core_config["random_outgoing_ports"]),
|
"chk_random_outgoing_ports": ("active", self.core_config["random_outgoing_ports"]),
|
||||||
|
"entry_peer_tos": ("text", self.core_config["peer_tos"]),
|
||||||
"chk_dht": ("active", self.core_config["dht"]),
|
"chk_dht": ("active", self.core_config["dht"]),
|
||||||
"chk_upnp": ("active", self.core_config["upnp"]),
|
"chk_upnp": ("active", self.core_config["upnp"]),
|
||||||
"chk_natpmp": ("active", self.core_config["natpmp"]),
|
"chk_natpmp": ("active", self.core_config["natpmp"]),
|
||||||
|
@ -352,6 +353,7 @@ class Preferences(component.Component):
|
||||||
"spin_outgoing_port_min",
|
"spin_outgoing_port_min",
|
||||||
"spin_outgoing_port_max",
|
"spin_outgoing_port_max",
|
||||||
"chk_random_outgoing_ports",
|
"chk_random_outgoing_ports",
|
||||||
|
"entry_peer_tos",
|
||||||
"chk_dht",
|
"chk_dht",
|
||||||
"chk_upnp",
|
"chk_upnp",
|
||||||
"chk_natpmp",
|
"chk_natpmp",
|
||||||
|
@ -534,7 +536,8 @@ class Preferences(component.Component):
|
||||||
new_core_config["outgoing_ports"] = outgoing_ports
|
new_core_config["outgoing_ports"] = outgoing_ports
|
||||||
new_core_config["random_outgoing_ports"] = \
|
new_core_config["random_outgoing_ports"] = \
|
||||||
self.glade.get_widget("chk_random_outgoing_ports").get_active()
|
self.glade.get_widget("chk_random_outgoing_ports").get_active()
|
||||||
|
|
||||||
|
new_core_config["peer_tos"] = self.glade.get_widget("entry_peer_tos").get_text()
|
||||||
new_core_config["dht"] = self.glade.get_widget("chk_dht").get_active()
|
new_core_config["dht"] = self.glade.get_widget("chk_dht").get_active()
|
||||||
new_core_config["upnp"] = self.glade.get_widget("chk_upnp").get_active()
|
new_core_config["upnp"] = self.glade.get_widget("chk_upnp").get_active()
|
||||||
new_core_config["natpmp"] = \
|
new_core_config["natpmp"] = \
|
||||||
|
|
|
@ -43,6 +43,7 @@ void bind_session_settings()
|
||||||
.def_readwrite("seed_time_ratio_limit", &session_settings::seed_time_ratio_limit)
|
.def_readwrite("seed_time_ratio_limit", &session_settings::seed_time_ratio_limit)
|
||||||
.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)
|
||||||
#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
|
||||||
|
|
Loading…
Reference in New Issue