mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
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:
1 parent
a3d1e865a8
commit
3560cda06c
17 files changed
+63
-38
No files matched your search
@@ -25,6 +25,7 @@ from gns3server.controller import Controller
|
||||
from gns3server.controller.import_project import import_project
|
||||
from gns3server.controller.export_project import export_project
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.asyncio import asyncio_ensure_future
|
||||
|
||||
|
||||
from gns3server.schemas.project import (
|
||||
@@ -246,7 +247,7 @@ class ProjectHandler:
|
||||
ws = aiohttp.web.WebSocketResponse()
|
||||
yield from ws.prepare(request)
|
||||
|
||||
asyncio.async(process_websocket(ws))
|
||||
asyncio_ensure_future(process_websocket(ws))
|
||||
|
||||
with controller.notification.queue(project) as queue:
|
||||
while True:
|
||||
|
||||
@@ -20,6 +20,7 @@ from gns3server.config import Config
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.schemas.version import VERSION_SCHEMA
|
||||
from gns3server.version import __version__
|
||||
from gns3server.utils.asyncio import asyncio_ensure_future
|
||||
|
||||
from aiohttp.web import HTTPConflict, HTTPForbidden
|
||||
|
||||
@@ -57,7 +58,7 @@ class ServerHandler:
|
||||
|
||||
tasks = []
|
||||
for project in projects:
|
||||
tasks.append(asyncio.async(project.close()))
|
||||
tasks.append(asyncio_ensure_future(project.close()))
|
||||
|
||||
if tasks:
|
||||
done, _ = yield from asyncio.wait(tasks)
|
||||
@@ -71,7 +72,7 @@ class ServerHandler:
|
||||
# then shutdown the server itself
|
||||
from gns3server.web.web_server import WebServer
|
||||
server = WebServer.instance()
|
||||
asyncio.async(server.shutdown_server())
|
||||
asyncio_ensure_future(server.shutdown_server())
|
||||
response.set_status(201)
|
||||
|
||||
@Route.get(
|
||||
|
||||
Reference in new issue
Block a user