infohash and trackers

General support for problems installing or using Deluge
PTPP
New User
New User
Posts: 8
Joined: Thu Dec 27, 2012 7:07 pm

Re: infohash and trackers

Post by PTPP »

And indeed setting the flags to 0 when creating the session will stop it from connecting to trackers. Any existing download that I had going continued to download, but I could not get any new infohash's to get to download after that change. They got peers but no seeders. Here's the diff of what I tried:

Code: Select all

--- core.py.orig	2013-01-06 13:33:31.381403974 +0200
+++ core.py	2013-01-06 13:33:49.673403741 +0200
@@ -87,7 +87,10 @@
         # Note: All libtorrent python bindings to set plugins/extensions need to be disabled
         # 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)
+        self.session = lt.session(lt.fingerprint("DE", *version), flags=0)
+        self.session.add_extension(lt.create_ut_pex_plugin)
+        self.session.add_extension(lt.create_ut_metadata_plugin)
+        self.session.add_extension(lt.create_smart_ban_plugin)
 
         # Load the session state if available
         self.__load_session_state()
The idea of it being that we add all the same plugins than before except the tracker. This would have to be done conditionally, of course.

Any ideas why download didn't work?

PTPP
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: infohash and trackers

Post by Cas »

Hmm this might be quite tricky as we need to keep compatibility with 0.15 but there is no other way to enable extensions in 0.15 without encountering the GIL issue.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: infohash and trackers

Post by Cas »

You need to enable the extensions like this in libtorrent >= 0.16.5:

Code: Select all

self.session.add_extension("ut_pex")
self.session.add_extension("ut_metadata")
self.session.add_extension("smart_ban")
self.session.add_extension("metadata_transfer")
PTPP
New User
New User
Posts: 8
Joined: Thu Dec 27, 2012 7:07 pm

Re: infohash and trackers

Post by PTPP »

Cas wrote:You need to enable the extensions like this in libtorrent >= 0.16.5:

Code: Select all

self.session.add_extension("ut_pex")
self.session.add_extension("ut_metadata")
self.session.add_extension("smart_ban")
self.session.add_extension("metadata_transfer")
Thanks, that fixes the issue for me. I can see from the GIL issue thread that it used to be like this, but had to be changed.

So now I have this:

Code: Select all

--- core.py.orig	2013-01-06 13:33:31.381403974 +0200
+++ core.py	2013-01-06 16:03:32.265289166 +0200
@@ -87,7 +87,11 @@
         # Note: All libtorrent python bindings to set plugins/extensions need to be disabled
         # 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)
+        self.session = lt.session(lt.fingerprint("DE", *version), flags=0)
+	self.session.add_extension("ut_pex")
+	self.session.add_extension("ut_metadata")
+	self.session.add_extension("smart_ban")
+	self.session.add_extension("metadata_transfer")
 
         # Load the session state if available
         self.__load_session_state()
Is it not possible to know the version of libtorrent in the python code?
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: infohash and trackers

Post by Cas »

Yes it is and I am putting a fix together but obviously unless you have >=0.16.5 we have no choice to enable all extensions.
Post Reply