1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Check for OSError when starting the server.

This commit is contained in:
Jeremy 2015-02-01 15:56:10 -07:00
parent 334835c985
commit 8d471a89a8
2 changed files with 7 additions and 2 deletions

View File

@ -79,7 +79,7 @@ def parse_arguments():
parser.add_argument("--ssl", action="store_true", help="run in SSL mode")
parser.add_argument("--certfile", help="SSL cert file", default="")
parser.add_argument("--certkey", help="SSL key file", default="")
parser.add_argument("-L", "--local", action="store_true", help="local mode (allow some insecure operations)")
parser.add_argument("-L", "--local", action="store_true", help="local mode (allows some insecure operations)")
parser.add_argument("-A", "--allow", action="store_true", help="allow remote connections to local console ports")
parser.add_argument("-q", "--quiet", action="store_true", help="do not show logs on stdout")
parser.add_argument("-d", "--debug", action="store_true", help="show debug logs and enable code live reload")

View File

@ -53,7 +53,12 @@ class Server:
@asyncio.coroutine
def _run_application(self, app, ssl_context=None):
server = yield from self._loop.create_server(app.make_handler(), self._host, self._port, ssl=ssl_context)
try:
server = yield from self._loop.create_server(app.make_handler(), self._host, self._port, ssl=ssl_context)
except OSError as e:
log.critical("Could not start the server: {}".format(e))
self._loop.stop()
return
return server
def _stop_application(self):