mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 11:28:55 +00:00
Clean exit when you Ctrl+C the server and client are still connected
This commit is contained in:
parent
5de27a95f9
commit
2842904769
@ -222,7 +222,6 @@ class Route(object):
|
|||||||
response.set_status(409)
|
response.set_status(409)
|
||||||
response.json({"message": str(e), "status": 409, "image": e.image, "exception": e.__class__.__name__})
|
response.json({"message": str(e), "status": 409, "image": e.image, "exception": e.__class__.__name__})
|
||||||
except asyncio.futures.CancelledError as e:
|
except asyncio.futures.CancelledError as e:
|
||||||
log.error("Request canceled")
|
|
||||||
response = Response(request=request, route=route)
|
response = Response(request=request, route=route)
|
||||||
response.set_status(408)
|
response.set_status(408)
|
||||||
response.json({"message": "Request canceled", "status": 408})
|
response.json({"message": "Request canceled", "status": 408})
|
||||||
|
@ -112,6 +112,10 @@ class WebServer:
|
|||||||
|
|
||||||
for task in asyncio.Task.all_tasks():
|
for task in asyncio.Task.all_tasks():
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
try:
|
||||||
|
yield from asyncio.wait_for(task, 1)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
self._loop.stop()
|
self._loop.stop()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user