diff --git a/gns3server/run.py b/gns3server/run.py index 5a8b4c1d..702a2c74 100644 --- a/gns3server/run.py +++ b/gns3server/run.py @@ -102,6 +102,7 @@ def parse_arguments(argv): parser.add_argument("--log", help="send output to logfile instead of console") parser.add_argument("--daemon", action="store_true", help="start as a daemon") parser.add_argument("--pid", help="store process pid") + parser.add_argument("--udpdiscovery", action="store_true", help="allow the server to be discover on the network") args = parser.parse_args(argv) if args.config: @@ -121,6 +122,7 @@ def parse_arguments(argv): "quiet": config.getboolean("quiet", False), "debug": config.getboolean("debug", False), "logfile": config.getboolean("logfile", ""), + "udp_discovery": config.getboolean("udp_discovery", False), } parser.set_defaults(**defaults) @@ -142,6 +144,7 @@ def set_config(args): server_config["record"] = args.record server_config["debug"] = str(args.debug) server_config["shell"] = str(args.shell) + server_config["udp_discovery"] = str(args.udpdiscovery) config.set_section_config("Server", server_config) diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index 5e9e9ba0..d66fc11a 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -92,6 +92,7 @@ class WebServer: Cleanly shutdown the server. """ + if self._handler: yield from self._handler.finish_connections() self._handler = None @@ -115,6 +116,7 @@ class WebServer: self._loop.stop() + def _signal_handling(self): def signal_handler(signame, *args): @@ -289,8 +291,8 @@ class WebServer: if server_config.getboolean("shell"): asyncio.async(self.start_shell()) - if sys.platform.startswith("linux"): - # UDP discovery is only supported on + if sys.platform.startswith("linux") and server_config.getboolean("udp_discovery"): + # UDP discovery is only supported on Linux self._loop.run_in_executor(None, self._udp_server_discovery) try: