mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fix traceback when a server is already running
This commit is contained in:
parent
03e31a2cb9
commit
9fc23f07f1
@ -83,8 +83,7 @@ class WebServer:
|
|||||||
server = yield from self._loop.create_server(handler, self._host, self._port, ssl=ssl_context)
|
server = yield from self._loop.create_server(handler, self._host, self._port, ssl=ssl_context)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
log.critical("Could not start the server: {}".format(e))
|
log.critical("Could not start the server: {}".format(e))
|
||||||
self._loop.stop()
|
return False
|
||||||
return
|
|
||||||
return server
|
return server
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -278,9 +277,6 @@ class WebServer:
|
|||||||
# Asyncio will raise error if coroutine is not called
|
# Asyncio will raise error if coroutine is not called
|
||||||
self._loop.set_debug(True)
|
self._loop.set_debug(True)
|
||||||
|
|
||||||
if server_config.getboolean("controller"):
|
|
||||||
asyncio.async(Controller.instance().start())
|
|
||||||
|
|
||||||
for key, val in os.environ.items():
|
for key, val in os.environ.items():
|
||||||
log.debug("ENV %s=%s", key, val)
|
log.debug("ENV %s=%s", key, val)
|
||||||
|
|
||||||
@ -303,14 +299,15 @@ class WebServer:
|
|||||||
log.info("Starting server on {}:{}".format(self._host, self._port))
|
log.info("Starting server on {}:{}".format(self._host, self._port))
|
||||||
self._handler = app.make_handler(handler=RequestHandler)
|
self._handler = app.make_handler(handler=RequestHandler)
|
||||||
server = self._run_application(self._handler, ssl_context)
|
server = self._run_application(self._handler, ssl_context)
|
||||||
|
if self._loop.run_until_complete(server) is False:
|
||||||
|
self._loop.stop()
|
||||||
|
return
|
||||||
|
|
||||||
self._loop.run_until_complete(server)
|
|
||||||
self._signal_handling()
|
self._signal_handling()
|
||||||
self._exit_handling()
|
self._exit_handling()
|
||||||
|
|
||||||
# Now the compute is initialized we can load the projects
|
|
||||||
if server_config.getboolean("controller"):
|
if server_config.getboolean("controller"):
|
||||||
asyncio.async(Controller.instance().load_projects())
|
controller_start = asyncio.async(Controller.instance().start())
|
||||||
|
|
||||||
if server_config.getboolean("shell"):
|
if server_config.getboolean("shell"):
|
||||||
asyncio.async(self.start_shell())
|
asyncio.async(self.start_shell())
|
||||||
|
Loading…
Reference in New Issue
Block a user