summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-10-02 14:56:07 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-10-02 14:56:07 -0300
commitbc0fecfdf6c7bd681b44ba4e39a054e05f16463d (patch)
tree85f640663e6d4e06f7e6079892a48bb2cc903d6d
parentbb8646d9769cb3c1d2b84b43047e6feaf8e40966 (diff)
[bug] move assign to prevent race condition
When the error happens too quickly, the errback is called before the assign of the callLater. And in the errback we cancel that call which gives an error. - Related: #7451
-rw-r--r--changes/bug-7451_missing-attribute1
-rw-r--r--src/leap/bitmask/services/soledad/soledadbootstrapper.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/changes/bug-7451_missing-attribute b/changes/bug-7451_missing-attribute
new file mode 100644
index 00000000..502210c6
--- /dev/null
+++ b/changes/bug-7451_missing-attribute
@@ -0,0 +1 @@
+- Assign the timeout 'call later' before starting the sync to prevent race conditions. Related to #7451.
diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
index ec758833..f3d50925 100644
--- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py
+++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
@@ -623,10 +623,10 @@ class Syncer(object):
logger.debug("BOOTSTRAPPER: trying to sync Soledad....")
# pass defer_decryption=False to get inline decryption
# for debugging.
- self._sync_deferred = self._soledad.sync(defer_decryption=True)
- self._sync_deferred.addCallbacks(self._success, self._error)
self._timeout_delayed_call = reactor.callLater(self.WAIT_MAX_SECONDS,
self._timeout)
+ self._sync_deferred = self._soledad.sync(defer_decryption=True)
+ self._sync_deferred.addCallbacks(self._success, self._error)
def _success(self, result):
logger.debug("Soledad has been synced!")