Ticket #2160: lt_gil_fix.patch

File lt_gil_fix.patch, 2.3 KB (added by Calum, 12 years ago)

Patch to disable add_extenstion and use session flags instead for libtorrent extensions

  • deluge/core/core.py

    diff --git a/deluge/core/core.py b/deluge/core/core.py
    index 4bda811..4ca3d96 100644
    a b def __init__(self, listen_interface=None):  
    8484        while len(version) < 4:
    8585            version.append(0)
    8686
    87         self.session = lt.session(lt.fingerprint("DE", *version), flags=0)
     87        # Note: All libtorrent python bindings to set plugins/extensions need to be disabled
     88        # due to  GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
     89        # Setting session flags to 1 enables all libtorrent default plugins
     90        self.session = lt.session(lt.fingerprint("DE", *version), flags=1)
    8891
    8992        # Load the session state if available
    9093        self.__load_session_state()
    def __init__(self, listen_interface=None):  
    103106        self.session.set_settings(self.settings)
    104107
    105108        # Load metadata extension
    106         self.session.add_extension(lt.create_metadata_plugin)
    107         self.session.add_extension(lt.create_ut_metadata_plugin)
    108         self.session.add_extension(lt.create_smart_ban_plugin)
     109        # Note: All libtorrent python bindings to set plugins/extensions need to be disabled
     110        # due to  GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
     111        # self.session.add_extension(lt.create_metadata_plugin)
     112        # self.session.add_extension(lt.create_ut_metadata_plugin)
     113        # self.session.add_extension(lt.create_smart_ban_plugin)
    109114
    110115        # Create the components
    111116        self.eventmanager = EventManager()
  • deluge/core/preferencesmanager.py

    diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py
    index 40070bb..2a5cb1b 100644
    a b def _on_set_lsd(self, key, value):  
    338338    def _on_set_utpex(self, key, value):
    339339        log.debug("utpex value set to %s", value)
    340340        if value:
    341             self.session.add_extension(lt.create_ut_pex_plugin)
     341            # Note: All libtorrent python bindings to set plugins/extensions need to be disabled
     342            # due to  GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
     343            #self.session.add_extension(lt.create_ut_pex_plugin)
     344            pass
    342345
    343346    def _on_set_encryption(self, key, value):
    344347        log.debug("encryption value %s set to %s..", key, value)