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:
--- 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.
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.
--- 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?