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

Allow signals to be processed on Windows.

This commit is contained in:
Jeremy 2015-02-27 12:51:39 -07:00
parent 38326f7d72
commit 1d6d2a39f0
2 changed files with 9 additions and 2 deletions

View File

@ -21,7 +21,6 @@ import datetime
import sys
import locale
import argparse
import configparser
from gns3server.server import Server
from gns3server.web.logger import init_logger

View File

@ -167,7 +167,15 @@ class Server:
server_config = Config.instance().get_section_config("Server")
if sys.platform.startswith("win"):
# 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
if server_config.getboolean("ssl"):