Skip to content
Browse files

Add a close method to AsyncHTTPClient.

  • Loading branch information...
1 parent 03308b1 commit 70fb42d6a0b5e4fa2eed4d3aa4c795b957798e19 Ben Darnell committed Mar 18, 2010
Showing with 11 additions and 0 deletions.
  1. +11 −0 tornado/
11 tornado/
@@ -124,6 +124,17 @@ def __new__(cls, io_loop=None, max_clients=10,
cls._ASYNC_CLIENTS[io_loop] = instance
return instance
+ def close(self):
+ """Destroys this http client, freeing any file descriptors used.
+ Not needed in normal use, but may be helpful in unittests that
+ create and destroy http clients. No other methods may be called
+ on the AsyncHTTPClient after close().
+ """
+ del AsyncHTTPClient._ASYNC_CLIENTS[self.io_loop]
+ for curl in self._curls:
+ curl.close()
+ self._multi.close()
def fetch(self, request, callback, **kwargs):
"""Executes an HTTPRequest, calling callback with an HTTPResponse.

0 comments on commit 70fb42d

Please sign in to comment.
Something went wrong with that request. Please try again.