summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-06-30 16:40:09 -0300
committerdrebs <drebs@leap.se>2015-06-30 16:40:09 -0300
commit839fa2e4811eae9992829dd46f42bb1780281abf (patch)
tree105f8accf42c1052cba4d3fb54c5c02918ec14db
parentd56b7be02a854c40ca9c7a9570d0b5c3333f01f5 (diff)
[feature] add close() method to client http target
HTTP client cached connections will hang around in the reactor if they are not properly cleaned up, and might raise a "reactor unclean" message on shutdown. This commit adds a close() method to the client http target that will cleanup those connections.
-rw-r--r--client/src/leap/soledad/client/http_target.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/http_target.py b/client/src/leap/soledad/client/http_target.py
index 30590ae1..ac078f39 100644
--- a/client/src/leap/soledad/client/http_target.py
+++ b/client/src/leap/soledad/client/http_target.py
@@ -75,8 +75,6 @@ class SoledadHTTPSyncTarget(SyncTarget):
:param source_replica_uid: The source replica uid which we use when
deferring decryption.
:type source_replica_uid: str
- :param url: The url of the target replica to sync with.
- :type url: str
:param creds: A dictionary containing the uuid and token.
:type creds: creds
:param crypto: An instance of SoledadCrypto so we can encrypt/decrypt
@@ -98,7 +96,7 @@ class SoledadHTTPSyncTarget(SyncTarget):
"""
if url.endswith("/"):
url = url[:-1]
- self._url = str(url) + "/sync-from/" + source_replica_uid
+ self._url = str(url) + "/sync-from/" + str(source_replica_uid)
self.source_replica_uid = source_replica_uid
self._auth_header = None
self.set_creds(creds)
@@ -111,6 +109,9 @@ class SoledadHTTPSyncTarget(SyncTarget):
self._sync_decr_pool = None
self._http = HTTPClient(cert_file)
+ def close(self):
+ self._http.close()
+
def set_creds(self, creds):
"""
Update credentials.