summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-07-28 19:37:17 -0400
committerKali Kaneko <kali@leap.se>2017-07-28 21:10:29 -0400
commit0aeff258276551b30c6f85638b812df545fe350e (patch)
tree8ef0c5a356eb13452229cd2e83a049e94c168f11
parent93346ab16452df61322a22e9f3437d950f2a102d (diff)
[bug] change status only when key is generated
- Resolves: #8986
-rw-r--r--src/leap/bitmask/core/mail_services.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 48528d8d..9c34c120 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -252,13 +252,19 @@ class KeymanagerContainer(Container):
def _found_key(key):
self.log.info('Found key: %r' % key)
+ self._set_status(userid, "on", keys="found")
return key
+ def key_generated_cb(passthru):
+ self._set_status(userid, "on", keys="found")
+ return passthru
+
def _if_not_found_generate(failure):
failure.trap(KeyNotFound)
self.log.info('Key not found, generating key for %s' % (userid,))
self._set_status(userid, "starting", keys="generating")
d = keymanager.gen_key()
+ d.addCallback(key_generated_cb)
d.addErrback(_log_key_error)
return d
@@ -272,7 +278,6 @@ class KeymanagerContainer(Container):
d = keymanager.get_key(userid, private=True, fetch_remote=False)
d.addCallbacks(_found_key, _if_not_found_generate)
d.addCallback(self._on_keymanager_ready_cb, keymanager, userid)
- self._set_status(userid, "on", keys="found")
return d
@defer.inlineCallbacks