summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2016-09-20 09:56:34 -0300
committerdrebs <drebs@riseup.net>2016-09-22 15:34:14 -0300
commit25312aef021f4a29ee19953a3a73e940179e2cf5 (patch)
tree8e1e53de9e7c8ef8ddb0a2b6bd27ab15bee109e0 /src/leap/bitmask
parentc31be3e1bf6e2ea1b081f011664df4313eb7dadf (diff)
[bug] delay send of generated key if token is not available (#8460)
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/core/mail_services.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 8935bdd..4b1d211 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -29,6 +29,8 @@ from collections import namedtuple
from twisted.application import service
from twisted.internet import defer
+from twisted.internet import reactor
+from twisted.internet import task
from twisted.python import log
from twisted.python.procutils import which
@@ -249,10 +251,15 @@ class KeymanagerContainer(Container):
# but this hasn't been successfully uploaded. How do we know that?
# XXX Should this be a method of bonafide instead?
# -----------------------------------------------------------------
+ log.msg("Key generated succesfully for %s" % userid)
+ if not self.get_instance(userid).token:
+ log.msg("Token not available yet, "
+ "wait before attempting to send key...")
+ return task.deferLater(reactor, 5, send_key, None)
+ log.msg("Sending key to server.")
d = keymanager.send_key()
d.addCallbacks(
- lambda _: log.msg(
- "Key generated successfully for %s" % userid),
+ lambda _: log.msg("Key sent to server."),
log_key_error("sending"))
return d