diff options
author | drebs <drebs@leap.se> | 2014-07-09 12:22:23 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2014-07-09 12:24:08 -0300 |
commit | d0b57fe6babdadc39342afe080dd29a3c95f786e (patch) | |
tree | d9a9da90ca7f4a38d4c5c150ec29ab03e732a46c /client/src | |
parent | c31442faf5d9518b49b917348594252248b64ea1 (diff) |
Close all connections after syncing (#5518).
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/leap/soledad/client/__init__.py | 1 | ||||
-rw-r--r-- | client/src/leap/soledad/client/sqlcipher.py | 1 | ||||
-rw-r--r-- | client/src/leap/soledad/client/sync.py | 2 | ||||
-rw-r--r-- | client/src/leap/soledad/client/target.py | 3 |
4 files changed, 5 insertions, 2 deletions
diff --git a/client/src/leap/soledad/client/__init__.py b/client/src/leap/soledad/client/__init__.py index 3dbba9b6..586e3389 100644 --- a/client/src/leap/soledad/client/__init__.py +++ b/client/src/leap/soledad/client/__init__.py @@ -407,6 +407,7 @@ class Soledad(object): # release the lock on shared db try: self._shared_db.unlock(token) + self._shared_db.close() except NotLockedError: # for some reason the lock expired. Despite that, secret # loading or generation/storage must have been executed diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py index 6f32ee76..2df9606e 100644 --- a/client/src/leap/soledad/client/sqlcipher.py +++ b/client/src/leap/soledad/client/sqlcipher.py @@ -482,7 +482,6 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): with SQLCipherDatabase.syncing_lock[self._get_replica_uid()]: syncer = self._get_syncer(url, creds=creds) yield syncer - #syncer.sync_target.close() @property def syncing(self): diff --git a/client/src/leap/soledad/client/sync.py b/client/src/leap/soledad/client/sync.py index 3d728742..be60d0ab 100644 --- a/client/src/leap/soledad/client/sync.py +++ b/client/src/leap/soledad/client/sync.py @@ -206,6 +206,8 @@ class SoledadSynchronizer(Synchronizer): except Exception as e: logger.error("Soledad sync error: %s" % str(e)) sync_target.stop() + finally: + sync_target.close() return my_gen diff --git a/client/src/leap/soledad/client/target.py b/client/src/leap/soledad/client/target.py index 48472c53..6d8ecfeb 100644 --- a/client/src/leap/soledad/client/target.py +++ b/client/src/leap/soledad/client/target.py @@ -833,6 +833,7 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth): self._sync_watcher.shutdown() if self._sync_decr_pool is not None: self._sync_decr_pool.close() + HTTPSyncTarget.close(self) @staticmethod def connect(url, source_replica_uid=None, crypto=None): @@ -1237,6 +1238,7 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth): last_known_generation, last_known_trans_id, headers, return_doc_cb, ensure_callback, sync_id, syncer_pool, defer_decryption=defer_decryption) + syncer_pool.cleanup() # delete documents from the sync database if defer_encryption: @@ -1249,7 +1251,6 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth): self._sync_exchange_lock.release() self._sync_watcher.stop() - syncer_pool.cleanup() self.stop() return cur_target_gen, cur_target_trans_id |