summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-09-16 12:01:20 -0400
committerKali Kaneko <kali@leap.se>2015-09-16 12:01:34 -0400
commit4cb22bcb42b271899c266e30a0ad5e6fd7abd977 (patch)
tree4209196670ecb4c5483ce3c79c145ca001372946
parent8acc8c9058ff5983a78d6df4f66d19de1762cf4d (diff)
parent223f26eb2df3378ce275da2774a7ae923519afa1 (diff)
Merge remote-tracking branch 'leapcode/pr/271' into develop
-rw-r--r--client/src/leap/soledad/client/encdecpool.py2
-rw-r--r--client/src/leap/soledad/client/http_target/api.py7
-rw-r--r--client/src/leap/soledad/client/sqlcipher.py1
-rw-r--r--common/src/leap/soledad/common/tests/util.py13
4 files changed, 10 insertions, 13 deletions
diff --git a/client/src/leap/soledad/client/encdecpool.py b/client/src/leap/soledad/client/encdecpool.py
index 2ad98767..6d3c11b9 100644
--- a/client/src/leap/soledad/client/encdecpool.py
+++ b/client/src/leap/soledad/client/encdecpool.py
@@ -74,6 +74,8 @@ class SyncEncryptDecryptPool(object):
self._started = True
def stop(self):
+ if not self._started:
+ return
self._started = False
self._destroy_pool()
# maybe cancel the next delayed call
diff --git a/client/src/leap/soledad/client/http_target/api.py b/client/src/leap/soledad/client/http_target/api.py
index dc13e9cc..dcc762f6 100644
--- a/client/src/leap/soledad/client/http_target/api.py
+++ b/client/src/leap/soledad/client/http_target/api.py
@@ -32,8 +32,13 @@ class SyncTargetAPI(SyncTarget):
Declares public methods and implements u1db.SyncTarget.
"""
+ @defer.inlineCallbacks
def close(self):
- self._http.close()
+ if self._sync_enc_pool:
+ self._sync_enc_pool.stop()
+ if self._sync_decr_pool:
+ self._sync_decr_pool.stop()
+ yield self._http.close()
def set_creds(self, creds):
"""
diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py
index 2151884a..22ddc87d 100644
--- a/client/src/leap/soledad/client/sqlcipher.py
+++ b/client/src/leap/soledad/client/sqlcipher.py
@@ -559,6 +559,7 @@ class SQLCipherU1DBSync(SQLCipherDatabase):
"""
Close the syncer and syncdb orderly
"""
+ super(SQLCipherU1DBSync, self).close()
# close all open syncers
for url in self._syncers.keys():
_, syncer = self._syncers[url]
diff --git a/common/src/leap/soledad/common/tests/util.py b/common/src/leap/soledad/common/tests/util.py
index 41307eb7..1c7adb91 100644
--- a/common/src/leap/soledad/common/tests/util.py
+++ b/common/src/leap/soledad/common/tests/util.py
@@ -345,20 +345,9 @@ class CouchDBTestCase(unittest.TestCase, MockedSharedDBTest):
"""
Make sure we have a CouchDB instance for a test.
"""
- server = self.couch_server = couchdb.Server()
- self.previous_dbs = set([db for db in server])
self.couch_port = 5984
self.couch_url = 'http://localhost:%d' % self.couch_port
-
- def tearDown(self):
- """
- Stop CouchDB instance for test.
- """
- current_dbs = set([db for db in self.couch_server])
- remaining_dbs = current_dbs - self.previous_dbs
- if remaining_dbs:
- raise Exception("tests created %s and didn't clean up!",
- remaining_dbs)
+ self.couch_server = couchdb.Server(self.couch_url)
def delete_db(self, name):
try: