From daba92b9921e49e5daf3ca04dd1b4ef6878045fa Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 9 May 2013 18:43:47 +0100 Subject: [PATCH] Fix #2324 : Encryption level set by deluge does not match libtorrent values The clients are using range (0-2) whereas actual bit values are (1-3) --- deluge/core/preferencesmanager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index bbfb48b33..68c7d7f50 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -310,11 +310,12 @@ class PreferencesManager(component.Component): def _on_set_encryption(self, key, value): log.debug("encryption value %s set to %s..", key, value) + pe_enc_level = {0: lt.enc_level.plaintext, 1: lt.enc_level.rc4, 2: lt.enc_level.both} pe_settings = lt.pe_settings() pe_settings.out_enc_policy = \ lt.enc_policy(self.config["enc_out_policy"]) pe_settings.in_enc_policy = lt.enc_policy(self.config["enc_in_policy"]) - pe_settings.allowed_enc_level = lt.enc_level(self.config["enc_level"]) + pe_settings.allowed_enc_level = lt.enc_level(pe_enc_level[self.config["enc_level"]]) pe_settings.prefer_rc4 = self.config["enc_prefer_rc4"] self.session.set_pe_settings(pe_settings) set = self.session.get_pe_settings()