Use asyncio.ensure_future() instead of asyncio.async() with conservative approach to support Python < 3.4.4. Fixes https://github.com/GNS3/gns3-gui/issues/2566

This commit is contained in:
grossmj committed 2018-08-24 18:57:18 +07:00
1 parent a3d1e865a8
commit 3560cda06c
17 files changed
+63 -38

No files matched your search

+4 -3
View File
@@ -35,6 +35,7 @@ from ..compute import MODULES
from ..compute.port_manager import PortManager
from ..compute.qemu import Qemu
from ..controller import Controller
from ..utils.asyncio import asyncio_ensure_future
# do not delete this import
import gns3server.handlers
@@ -136,7 +137,7 @@ class WebServer:
def signal_handler(signame, *args):
log.warning("Server has got signal {}, exiting...".format(signame))
asyncio.async(self.shutdown_server())
asyncio_ensure_future(self.shutdown_server())
signals = ["SIGTERM", "SIGINT"]
if sys.platform.startswith("win"):
@@ -203,7 +204,7 @@ class WebServer:
# Because with a large image collection
# without md5sum already computed we start the
# computing with server start
asyncio.async(Qemu.instance().list_images())
asyncio_ensure_future(Qemu.instance().list_images())
def run(self):
"""
@@ -283,7 +284,7 @@ class WebServer:
self._exit_handling()
if server_config.getboolean("shell"):
asyncio.async(self.start_shell())
asyncio_ensure_future(self.start_shell())
try:
self._loop.run_forever()