mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Allow signals to be processed on Windows.
This commit is contained in:
parent
38326f7d72
commit
1d6d2a39f0
@ -21,7 +21,6 @@ import datetime
|
|||||||
import sys
|
import sys
|
||||||
import locale
|
import locale
|
||||||
import argparse
|
import argparse
|
||||||
import configparser
|
|
||||||
|
|
||||||
from gns3server.server import Server
|
from gns3server.server import Server
|
||||||
from gns3server.web.logger import init_logger
|
from gns3server.web.logger import init_logger
|
||||||
|
@ -167,7 +167,15 @@ class Server:
|
|||||||
server_config = Config.instance().get_section_config("Server")
|
server_config = Config.instance().get_section_config("Server")
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
# use the Proactor event loop on Windows
|
# use the Proactor event loop on Windows
|
||||||
asyncio.set_event_loop(asyncio.ProactorEventLoop())
|
loop = asyncio.ProactorEventLoop()
|
||||||
|
|
||||||
|
# Add a periodic callback to give a chance to process signals on Windows
|
||||||
|
# because asyncio.add_signal_handler() is not supported yet on that platform
|
||||||
|
# otherwise the loop runs outside of signal module's ability to trap signals.
|
||||||
|
def wakeup():
|
||||||
|
loop.call_later(0.1, wakeup)
|
||||||
|
loop.call_later(0.1, wakeup)
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
|
||||||
ssl_context = None
|
ssl_context = None
|
||||||
if server_config.getboolean("ssl"):
|
if server_config.getboolean("ssl"):
|
||||||
|
Loading…
Reference in New Issue
Block a user