added close methods to everything below transport
This commit is contained in:
@@ -86,3 +86,10 @@ class RequestsHttpConnection(Connection):
|
|||||||
self.log_request_success(method, url, response.request.path_url, body, response.status_code, raw_data, duration)
|
self.log_request_success(method, url, response.request.path_url, body, response.status_code, raw_data, duration)
|
||||||
|
|
||||||
return response.status_code, response.headers, raw_data
|
return response.status_code, response.headers, raw_data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Explicitly closes connections
|
||||||
|
"""
|
||||||
|
self.session.close()
|
||||||
|
return True
|
||||||
@@ -113,3 +113,9 @@ class Urllib3HttpConnection(Connection):
|
|||||||
|
|
||||||
return response.status, response.getheaders(), raw_data
|
return response.status, response.getheaders(), raw_data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Explicitly closes connection
|
||||||
|
"""
|
||||||
|
self.pool.close()
|
||||||
|
return True
|
||||||
|
|||||||
@@ -24,3 +24,10 @@ class PoolingConnection(Connection):
|
|||||||
|
|
||||||
def _release_connection(self, con):
|
def _release_connection(self, con):
|
||||||
self._free_connections.put(con)
|
self._free_connections.put(con)
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Explicitly close connection
|
||||||
|
"""
|
||||||
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -227,6 +227,14 @@ class ConnectionPool(object):
|
|||||||
# only one connection, no need for a selector
|
# only one connection, no need for a selector
|
||||||
return connections[0]
|
return connections[0]
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Explicitly closes connections
|
||||||
|
"""
|
||||||
|
for conn in self.connections:
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
class DummyConnectionPool(ConnectionPool):
|
class DummyConnectionPool(ConnectionPool):
|
||||||
def __init__(self, connections, **kwargs):
|
def __init__(self, connections, **kwargs):
|
||||||
@@ -241,6 +249,13 @@ class DummyConnectionPool(ConnectionPool):
|
|||||||
def get_connection(self):
|
def get_connection(self):
|
||||||
return self.connection
|
return self.connection
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Explicitly closes connections
|
||||||
|
"""
|
||||||
|
for conn in self.connections:
|
||||||
|
conn.close()
|
||||||
|
|
||||||
def _noop(self, *args, **kwargs):
|
def _noop(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
mark_dead = mark_live = resurrect = _noop
|
mark_dead = mark_live = resurrect = _noop
|
||||||
|
|||||||
@@ -353,3 +353,9 @@ class Transport(object):
|
|||||||
data = self.deserializer.loads(data, headers.get('content-type'))
|
data = self.deserializer.loads(data, headers.get('content-type'))
|
||||||
return status, data
|
return status, data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Explcitly closes connections
|
||||||
|
"""
|
||||||
|
self.connection_pool.close()
|
||||||
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user