#2218 #2254 : Re-enable utpex control and add lt_tex (tracker exchange)

This commit is contained in:
Calum Lind 2013-05-03 01:15:38 +01:00
commit 6e8e7a63cc
10 changed files with 88 additions and 52 deletions

View file

@ -80,10 +80,7 @@ class Core(component.Component):
while len(version) < 4: while len(version) < 4:
version.append(0) version.append(0)
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled self.session = lt.session(lt.fingerprint("DE", *version), flags=0)
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
# Setting session flags to 1 enables all libtorrent default plugins
self.session = lt.session(lt.fingerprint("DE", *version), flags=1)
# Load the session state if available # Load the session state if available
self.__load_session_state() self.__load_session_state()
@ -105,12 +102,9 @@ class Core(component.Component):
lt.io_buffer_mode_t.disable_os_cache lt.io_buffer_mode_t.disable_os_cache
self.session.set_settings(self.settings) self.session.set_settings(self.settings)
# Load metadata extension self.session.add_extension("metadata_transfer")
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled self.session.add_extension("ut_metadata")
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369 self.session.add_extension("smart_ban")
# self.session.add_extension(lt.create_metadata_plugin)
# self.session.add_extension(lt.create_ut_metadata_plugin)
# self.session.add_extension(lt.create_smart_ban_plugin)
# Create the components # Create the components
self.eventmanager = EventManager() self.eventmanager = EventManager()

View file

@ -68,6 +68,7 @@ DEFAULT_PREFS = {
"upnp": True, "upnp": True,
"natpmp": True, "natpmp": True,
"utpex": True, "utpex": True,
"lt_tex": True,
"lsd": True, "lsd": True,
"enc_in_policy": 1, "enc_in_policy": 1,
"enc_out_policy": 1, "enc_out_policy": 1,
@ -288,10 +289,12 @@ class PreferencesManager(component.Component):
def _on_set_utpex(self, key, value): def _on_set_utpex(self, key, value):
log.debug("utpex value set to %s", value) log.debug("utpex value set to %s", value)
if value: if value:
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled self.session.add_extension("ut_pex")
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
#self.session.add_extension(lt.create_ut_pex_plugin) def _on_set_lt_tex(self, key, value):
pass log.debug("lt_tex value set to %s", value)
if value:
self.session.add_extension("lt_trackers")
def _on_set_enc_in_policy(self, key, value): def _on_set_enc_in_policy(self, key, value):
self._on_set_encryption(key, value) self._on_set_encryption(key, value)

View file

@ -184,9 +184,6 @@ class TorrentResumedEvent(DelugeEvent):
class TorrentFileCompletedEvent(DelugeEvent): class TorrentFileCompletedEvent(DelugeEvent):
""" """
Emitted when a file completes. Emitted when a file completes.
This will only work with libtorrent 0.15 or greater.
""" """
def __init__(self, torrent_id, index): def __init__(self, torrent_id, index):
""" """

View file

@ -279,6 +279,7 @@ class NetworkPane(BasePane):
self.add_checked_input("upnp","UPnP",parent.core_config["upnp"]) self.add_checked_input("upnp","UPnP",parent.core_config["upnp"])
self.add_checked_input("natpmp","NAT-PMP",parent.core_config["natpmp"]) self.add_checked_input("natpmp","NAT-PMP",parent.core_config["natpmp"])
self.add_checked_input("utpex","Peer Exchange",parent.core_config["utpex"]) self.add_checked_input("utpex","Peer Exchange",parent.core_config["utpex"])
self.add_checked_input("lt_tex","Tracker Exchange",parent.core_config["lt_tex"])
self.add_checked_input("lsd","LSD",parent.core_config["lsd"]) self.add_checked_input("lsd","LSD",parent.core_config["lsd"])
self.add_checked_input("dht","DHT",parent.core_config["dht"]) self.add_checked_input("dht","DHT",parent.core_config["dht"])

View file

@ -1505,7 +1505,7 @@ used sparingly.</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="receives_default">False</property> <property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Peer Exchange</property> <property name="tooltip_text" translatable="yes">Exchanges peers between clients. (Changing setting requires restart)</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1516,6 +1516,26 @@ used sparingly.</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="chk_lt_tex">
<property name="label" translatable="yes">Tracker Exchange</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Exchanges trackers between clients. (Changing setting requires restart)</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="chk_lsd"> <object class="GtkCheckButton" id="chk_lsd">
<property name="label" translatable="yes">LSD</property> <property name="label" translatable="yes">LSD</property>

View file

@ -323,6 +323,7 @@ class Preferences(component.Component):
"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"]),
"chk_utpex": ("active", self.core_config["utpex"]), "chk_utpex": ("active", self.core_config["utpex"]),
"chk_lt_tex": ("active", self.core_config["lt_tex"]),
"chk_lsd": ("active", self.core_config["lsd"]), "chk_lsd": ("active", self.core_config["lsd"]),
"chk_new_releases": ("active", self.core_config["new_release_check"]), "chk_new_releases": ("active", self.core_config["new_release_check"]),
"chk_send_info": ("active", self.core_config["send_info"]), "chk_send_info": ("active", self.core_config["send_info"]),
@ -478,6 +479,7 @@ class Preferences(component.Component):
"chk_upnp", "chk_upnp",
"chk_natpmp", "chk_natpmp",
"chk_utpex", "chk_utpex",
"chk_lt_tex",
"chk_lsd", "chk_lsd",
"chk_send_info", "chk_send_info",
"chk_new_releases", "chk_new_releases",
@ -678,6 +680,8 @@ class Preferences(component.Component):
self.builder.get_object("chk_natpmp").get_active() self.builder.get_object("chk_natpmp").get_active()
new_core_config["utpex"] = \ new_core_config["utpex"] = \
self.builder.get_object("chk_utpex").get_active() self.builder.get_object("chk_utpex").get_active()
new_core_config["lt_tex"] = \
self.builder.get_object("chk_lt_tex").get_active()
new_core_config["lsd"] = \ new_core_config["lsd"] = \
self.builder.get_object("chk_lsd").get_active() self.builder.get_object("chk_lsd").get_active()
new_core_config["enc_in_policy"] = \ new_core_config["enc_in_policy"] = \

View file

@ -755,6 +755,9 @@ GetText.add('Total Size', '${escape(_("Total Size"))}')
// EditTrackersWindow.js:80, TorrentGrid.js:193, EditTrackerWindow.js:66, DetailsTab.js:53, ProxyPage.js:64 // EditTrackersWindow.js:80, TorrentGrid.js:193, EditTrackerWindow.js:66, DetailsTab.js:53, ProxyPage.js:64
GetText.add('Tracker', '${escape(_("Tracker"))}') GetText.add('Tracker', '${escape(_("Tracker"))}')
// NetworkPage.js:232
GetText.add('Tracker Exchange', '${escape(_("Tracker Exchange"))}')
// Sidebar.js:35 // Sidebar.js:35
GetText.add('Tracker Host', '${escape(_("Tracker Host"))}') GetText.add('Tracker Host', '${escape(_("Tracker Host"))}')

View file

@ -3614,6 +3614,13 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'dht' name: 'dht'
})); }));
optMan.bind('lt_tex', fieldset.add({
fieldLabel: '',
labelSeparator: '',
boxLabel: _('Tracker Exchange'),
ctCls: 'x-deluge-indent-checkbox',
name: 'lt_tex'
}));
} }
}); });
/*! /*!
@ -3696,9 +3703,9 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
xtype: 'panel', xtype: 'panel',
border: false, border: false,
bodyCfg: { bodyCfg: {
html: _('Help us improve Deluge by sending us your ' html: _('Help us improve Deluge by sending us your \
+ 'Python version, PyGTK version, OS and processor ' Python version, PyGTK version, OS and processor \
+ 'types. Absolutely no other information is sent.') types. Absolutely no other information is sent.')
} }
}); });
optMan.bind('send_info', fieldset.add({ optMan.bind('send_info', fieldset.add({
@ -5089,7 +5096,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
* @private * @private
*/ */
onFieldChange: function(field, event) { onFieldChange: function(field, event) {
if (field.field) field = field.field // fix for spinners if (field.field) field = field.field; // fix for spinners
this.update(field._doption, field.getValue()); this.update(field._doption, field.getValue());
}, },

View file

@ -765,7 +765,7 @@ Ext.namespace("Deluge.preferences");Deluge.preferences.Interface=Ext.extend(Ext.
* this exception statement from your version. If you delete this exception * this exception statement from your version. If you delete this exception
* statement from all source files in the program, then also delete it here. * statement from all source files in the program, then also delete it here.
*/ */
Ext.namespace("Deluge.preferences");Deluge.preferences.Network=Ext.extend(Ext.form.FormPanel,{border:false,layout:"form",title:_("Network"),initComponent:function(){Deluge.preferences.Network.superclass.initComponent.call(this);var b=deluge.preferences.getOptionsManager();var a=this.add({xtype:"fieldset",border:false,title:_("Incoming Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_port",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_port",height:22,listeners:{check:{fn:function(d,c){this.listenPorts.setDisabled(c)},scope:this}}}));this.listenPorts=a.add({xtype:"spinnergroup",name:"listen_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("listen_ports",this.listenPorts);a=this.add({xtype:"fieldset",border:false,title:_("Outgoing Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_outgoing_ports",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_outgoing_ports",height:22,listeners:{check:{fn:function(d,c){this.outgoingPorts.setDisabled(c)},scope:this}}}));this.outgoingPorts=a.add({xtype:"spinnergroup",name:"outgoing_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("outgoing_ports",this.outgoingPorts);a=this.add({xtype:"fieldset",border:false,title:_("Network Interface"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"textfield"});b.bind("listen_interface",a.add({name:"listen_interface",fieldLabel:"",labelSeparator:"",width:200}));a=this.add({xtype:"fieldset",border:false,title:_("TOS"),style:"margin-bottom: 5px; padding-bottom: 0px;",bodyStyle:"margin: 0px; padding: 0px",autoHeight:true,defaultType:"textfield"});b.bind("peer_tos",a.add({name:"peer_tos",fieldLabel:_("Peer TOS Byte"),width:80}));a=this.add({xtype:"fieldset",border:false,title:_("Network Extras"),autoHeight:true,layout:"table",layoutConfig:{columns:3},defaultType:"checkbox"});b.bind("upnp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("UPnP"),name:"upnp"}));b.bind("natpmp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("NAT-PMP"),ctCls:"x-deluge-indent-checkbox",name:"natpmp"}));b.bind("utpex",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Peer Exchange"),ctCls:"x-deluge-indent-checkbox",name:"utpex"}));b.bind("lsd",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("LSD"),name:"lsd"}));b.bind("dht",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("DHT"),ctCls:"x-deluge-indent-checkbox",name:"dht"}))}}); Ext.namespace("Deluge.preferences");Deluge.preferences.Network=Ext.extend(Ext.form.FormPanel,{border:false,layout:"form",title:_("Network"),initComponent:function(){Deluge.preferences.Network.superclass.initComponent.call(this);var b=deluge.preferences.getOptionsManager();var a=this.add({xtype:"fieldset",border:false,title:_("Incoming Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_port",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_port",height:22,listeners:{check:{fn:function(d,c){this.listenPorts.setDisabled(c)},scope:this}}}));this.listenPorts=a.add({xtype:"spinnergroup",name:"listen_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("listen_ports",this.listenPorts);a=this.add({xtype:"fieldset",border:false,title:_("Outgoing Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_outgoing_ports",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_outgoing_ports",height:22,listeners:{check:{fn:function(d,c){this.outgoingPorts.setDisabled(c)},scope:this}}}));this.outgoingPorts=a.add({xtype:"spinnergroup",name:"outgoing_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("outgoing_ports",this.outgoingPorts);a=this.add({xtype:"fieldset",border:false,title:_("Network Interface"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"textfield"});b.bind("listen_interface",a.add({name:"listen_interface",fieldLabel:"",labelSeparator:"",width:200}));a=this.add({xtype:"fieldset",border:false,title:_("TOS"),style:"margin-bottom: 5px; padding-bottom: 0px;",bodyStyle:"margin: 0px; padding: 0px",autoHeight:true,defaultType:"textfield"});b.bind("peer_tos",a.add({name:"peer_tos",fieldLabel:_("Peer TOS Byte"),width:80}));a=this.add({xtype:"fieldset",border:false,title:_("Network Extras"),autoHeight:true,layout:"table",layoutConfig:{columns:3},defaultType:"checkbox"});b.bind("upnp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("UPnP"),name:"upnp"}));b.bind("natpmp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("NAT-PMP"),ctCls:"x-deluge-indent-checkbox",name:"natpmp"}));b.bind("utpex",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Peer Exchange"),ctCls:"x-deluge-indent-checkbox",name:"utpex"}));b.bind("lsd",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("LSD"),name:"lsd"}));b.bind("dht",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("DHT"),ctCls:"x-deluge-indent-checkbox",name:"dht"}));b.bind("lt_tex",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Tracker Exchange"),ctCls:"x-deluge-indent-checkbox",name:"lt_tex"}))}});
/* /*
* Deluge.preferences.OtherPage.js * Deluge.preferences.OtherPage.js
* *

View file

@ -226,5 +226,12 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'dht' name: 'dht'
})); }));
optMan.bind('lt_tex', fieldset.add({
fieldLabel: '',
labelSeparator: '',
boxLabel: _('Tracker Exchange'),
ctCls: 'x-deluge-indent-checkbox',
name: 'lt_tex'
}));
} }
}); });