mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-12 17:10:55 +00:00
Add a settings in command line and config file to enable discovery
This commit is contained in:
parent
f45901e861
commit
45d7e09cbd
@ -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)
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user