Skip to content

Commit 77a40ad

Browse files
quietcricketlepture
authored andcommitted
Fix tornado 4.5 above not closing connections on autoreload, (#157)
resulting the browser to limbo in pending state.
1 parent f3b17f1 commit 77a40ad

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

livereload/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from tornado.wsgi import WSGIContainer
2121
from tornado.ioloop import IOLoop
22+
from tornado.autoreload import add_reload_hook
2223
from tornado import web
2324
from tornado import escape
2425
from tornado import httputil
@@ -298,6 +299,7 @@ def opener():
298299
try:
299300
self.watcher._changes.append(('__livereload__', restart_delay))
300301
LiveReloadHandler.start_tasks()
302+
add_reload_hook(lambda: IOLoop.instance().close(all_fds=True))
301303
IOLoop.instance().start()
302304
except KeyboardInterrupt:
303305
logger.info('Shutting down...')

0 commit comments

Comments
 (0)