changeset 1723:5632c5350296

core: avoid initialisation blocking when a long callback is added to backend.initialised (could prevent sessions starting)
author Goffi <goffi@goffi.org>
date Mon, 07 Dec 2015 13:10:44 +0100
parents 4308bca92922
children 13e43b2cd7a2
files src/memory/memory.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/memory/memory.py	Mon Dec 07 13:10:44 2015 +0100
+++ b/src/memory/memory.py	Mon Dec 07 13:10:44 2015 +0100
@@ -355,7 +355,10 @@
             auth_d.addCallback(doStartSession)
             return auth_d
 
-        return self.host.initialised.addCallback(backendInitialised)
+        if self.host.initialised.called:
+            return defer.succeed(None).addCallback(backendInitialised)
+        else:
+            return self.host.initialised.addCallback(backendInitialised)
 
     def stopSession(self, profile):
         """Delete a profile session