1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-23 23:38:21 +00:00

Close connections for auto-reload.

This commit is contained in:
grossmj 2015-03-01 21:13:51 -07:00
parent c48ca212bd
commit 46b0ead329

View File

@ -103,12 +103,13 @@ class Server:
else:
self._loop.add_signal_handler(getattr(signal, signal_name), callback)
def _reload_hook(self):
def _reload_hook(self, handler):
@asyncio.coroutine
def reload():
log.info("Reloading")
yield from handler.finish_connections()
yield from self._stop_application()
os.execv(sys.executable, [sys.executable] + sys.argv)
@ -201,7 +202,7 @@ class Server:
if server_config.getboolean("live"):
log.info("Code live reload is enabled, watching for file changes")
self._loop.call_later(1, self._reload_hook)
self._loop.call_later(1, self._reload_hook, handler)
if server_config.getboolean("shell"):
asyncio.async(self.start_shell())