diff options
author | drebs <drebs@leap.se> | 2015-07-08 19:14:00 -0300 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2015-07-22 10:04:22 -0400 |
commit | 46870f1e26ef159bf6fe4744aba3b00a5e81cc3b (patch) | |
tree | 757156ea138e54c1305994cf8807e16d648b737e /src/leap | |
parent | 467b14fa2e29ecd6f41d4834b00593d8c86cddc5 (diff) |
[feat] add close method for http agent
The ability to close cached connections is needed in order to have a clean
reactor when the program ends.
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/common/http.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/leap/common/http.py b/src/leap/common/http.py index d4a214c..8d22f2c 100644 --- a/src/leap/common/http.py +++ b/src/leap/common/http.py @@ -80,6 +80,7 @@ class HTTPClient(object): policy = get_compatible_ssl_context_factory(cert_file) + self._pool = pool self._agent = Agent( reactor, policy, @@ -110,6 +111,12 @@ class HTTPClient(object): d.addCallback(readBody) return d + def close(self): + """ + Close any cached connections. + """ + self._pool.closeCachedConnections() + class StringBodyProducer(object): """ A producer that writes the body of a request to a consumer. |