summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-08-06 12:59:30 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-08-12 17:17:17 -0300
commit242e21dff3260a2dba303299e41667679e6d2e87 (patch)
tree8d9fb17c2cfe1d7153421e47785f7cc6f6531a9d
parent775105a8caee2c796121ca1598530af0422060b6 (diff)
[bug] close http_target when soledad closes
Soledad has a close method that wasn't calling http_target close. The reference to sync exchange was being deleted without proper closing of underlying resources.
-rw-r--r--client/src/leap/soledad/client/api.py3
-rw-r--r--client/src/leap/soledad/client/sqlcipher.py1
-rw-r--r--client/src/leap/soledad/client/sync.py3
3 files changed, 6 insertions, 1 deletions
diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py
index 1be3adac..5ba93721 100644
--- a/client/src/leap/soledad/client/api.py
+++ b/client/src/leap/soledad/client/api.py
@@ -301,7 +301,8 @@ class Soledad(object):
if getattr(self, '_dbsyncer', None):
self._dbsyncer.close()
# close the sync database
- self._sync_db.close()
+ if self._sync_db:
+ self._sync_db.close()
self._sync_db = None
if self._defer_encryption:
self._sync_enc_pool.stop()
diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py
index 34fd90b4..a76a35b7 100644
--- a/client/src/leap/soledad/client/sqlcipher.py
+++ b/client/src/leap/soledad/client/sqlcipher.py
@@ -633,6 +633,7 @@ class SQLCipherU1DBSync(SQLCipherDatabase):
"""
# close all open syncers
for url in self._syncers.keys():
+ self._syncers[url][1].close()
del self._syncers[url]
diff --git a/client/src/leap/soledad/client/sync.py b/client/src/leap/soledad/client/sync.py
index 77abd868..1a881555 100644
--- a/client/src/leap/soledad/client/sync.py
+++ b/client/src/leap/soledad/client/sync.py
@@ -184,6 +184,9 @@ class SoledadSynchronizer(Synchronizer):
# if gapless record current reached generation with target
return self._record_sync_info_with_the_target(info["my_gen"])
+ def close(self):
+ self.sync_target.close()
+
def _record_sync_info_with_the_target(self, start_generation):
"""
Store local replica metadata in server.