From: Ben Darnell Date: Sun, 20 Jan 2013 20:46:01 +0000 (-0500) Subject: Make autoreload close the IOLoop through the standard interface. X-Git-Tag: v3.0.0~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c3c8f7620a30b9442726679a81866e70a9d1d58;p=thirdparty%2Ftornado.git Make autoreload close the IOLoop through the standard interface. This makes it compatible with TwistedIOLoop. --- diff --git a/tornado/autoreload.py b/tornado/autoreload.py index e18ecc0d6..4e424878f 100644 --- a/tornado/autoreload.py +++ b/tornado/autoreload.py @@ -105,7 +105,7 @@ def start(io_loop=None, check_time=500): _io_loops[io_loop] = True if len(_io_loops) > 1: gen_log.warning("tornado.autoreload started more than once in the same process") - add_reload_hook(functools.partial(_close_all_fds, io_loop)) + add_reload_hook(functools.partial(io_loop.close, all_fds=True)) modify_times = {} callback = functools.partial(_reload_on_update, modify_times) scheduler = ioloop.PeriodicCallback(callback, check_time, io_loop=io_loop) @@ -143,14 +143,6 @@ def add_reload_hook(fn): _reload_hooks.append(fn) -def _close_all_fds(io_loop): - for fd in io_loop._handlers.keys(): - try: - os.close(fd) - except Exception: - pass - - def _reload_on_update(modify_times): if _reload_attempted: # We already tried to reload and it didn't work, so don't try again.