summaryrefslogtreecommitdiff
path: root/client/src/leap
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2016-10-04 18:40:33 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-10-12 10:45:44 -0300
commit2b6a0e8d7168b20f86d585ebc4e57b61b1bb9cf9 (patch)
tree0cb96679f6e7f98121e524ab4602f57ebc158ed2 /client/src/leap
parent4e06eb370b99f2d343e96f774a3ad9b8b77c9548 (diff)
[bug] remove finalClose from SQLCipherU1DBSync
We discovered that class was registering a `finalClose` to be executed on reactor shutdown. On the multiuser scenario, a logout destroys Soledad and should properly terminate everything related to it. That SQLCipherU1DBSync instance was being held even after logout by the reactor so it could call that `finalClose` on shutdown. The `finalClose` only set running to False and set a `shutdownID` that was not used anywhere else, so we removed it and moved setting running to False to the `close` function method. That way we preserve the functionality but let the instance be properly garbage collected on logout.
Diffstat (limited to 'client/src/leap')
-rw-r--r--client/src/leap/soledad/client/sqlcipher.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py
index 14d6f5ae..3921c323 100644
--- a/client/src/leap/soledad/client/sqlcipher.py
+++ b/client/src/leap/soledad/client/sqlcipher.py
@@ -448,7 +448,6 @@ class SQLCipherU1DBSync(SQLCipherDatabase):
self.received_docs = []
self.running = False
- self.shutdownID = None
self._db_handle = None
# initialize the main db before scheduling a start
@@ -465,8 +464,6 @@ class SQLCipherU1DBSync(SQLCipherDatabase):
def _start(self):
if not self.running:
- self.shutdownID = self._reactor.addSystemEventTrigger(
- 'during', 'shutdown', self.finalClose)
self.running = True
def _initialize_main_db(self):
@@ -561,13 +558,6 @@ class SQLCipherU1DBSync(SQLCipherDatabase):
# XXX this SHOULD BE a callback
return self._get_generation()
- def finalClose(self):
- """
- This should only be called by the shutdown trigger.
- """
- self.shutdownID = None
- self.running = False
-
def close(self):
"""
Close the syncer and syncdb orderly
@@ -578,6 +568,7 @@ class SQLCipherU1DBSync(SQLCipherDatabase):
_, syncer = self._syncers[url]
syncer.close()
del self._syncers[url]
+ self.running = False
class U1DBSQLiteBackend(sqlite_backend.SQLitePartialExpandDatabase):