diff options
author | Kali Kaneko <kali@leap.se> | 2014-01-31 11:37:45 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-01-31 11:37:45 -0400 |
commit | 36e49c638cbfba25466644553009526ef87c01b8 (patch) | |
tree | 23960e1b88888e7ac2d368ffb2c78a739e877699 | |
parent | c43b7378164d15a40e5ad8413a463995d2d88ca4 (diff) | |
parent | 80a3983b5d3562906fcc81e8b196810d7d5a82cc (diff) |
Merge remote-tracking branch 'chiiph/feature/5083_sync_soledad_only_on_account_create' into develop
-rw-r--r-- | changes/bug_5083_sync_soledad_only_on_account_create | 3 | ||||
-rw-r--r-- | src/leap/bitmask/services/soledad/soledadbootstrapper.py | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/changes/bug_5083_sync_soledad_only_on_account_create b/changes/bug_5083_sync_soledad_only_on_account_create new file mode 100644 index 00000000..6deaa41f --- /dev/null +++ b/changes/bug_5083_sync_soledad_only_on_account_create @@ -0,0 +1,3 @@ +- Sync Soledad before bootstrapping mail only if the key for the user + is not found locally. Otherwise, defer to thread and + continue. Closes #5083
\ No newline at end of file diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py index 5351bcd2..f7217af6 100644 --- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py +++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py @@ -26,6 +26,7 @@ from ssl import SSLError from PySide import QtCore from u1db import errors as u1db_errors +from twisted.internet import threads from zope.proxy import sameProxiedObjects from leap.bitmask.config import flags @@ -288,7 +289,18 @@ class SoledadBootstrapper(AbstractBootstrapper): self._init_keymanager(self._address) self.local_only_ready.emit({self.PASSED_KEY: True}) else: - self._do_soledad_sync() + try: + address = make_address( + self._user, self._provider_config.get_domain()) + self._init_keymanager(address) + self._keymanager.get_key( + address, openpgp.OpenPGPKey, + private=True, fetch_remote=False) + threads.deferToThread(self._do_soledad_sync) + except KeyNotFound: + logger.debug("Key not found. Generating key for %s" % + (address,)) + self._do_soledad_sync() def _pick_server(self, uuid): """ @@ -546,7 +558,6 @@ class SoledadBootstrapper(AbstractBootstrapper): address = make_address( self._user, self._provider_config.get_domain()) - self._init_keymanager(address) logger.debug("Retrieving key for %s" % (address,)) try: |