From bec227033409db42801d9f004b1bdb346e759119 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 30 Nov 2018 17:06:21 +0800 Subject: [PATCH] Fix non responsive console for Docker VMs. Fixes https://github.com/GNS3/gns3-gui/issues/2645 --- gns3server/compute/docker/docker_vm.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index a0ee4a61..216a5889 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -643,7 +643,7 @@ class DockerVM(BaseNode): async def drain(self): if not self.ws.closed: - self.ws.send_bytes(self._data) + await self.ws.send_bytes(self._data) self._data = b"" output_stream = asyncio.StreamReader() @@ -671,15 +671,15 @@ class DockerVM(BaseNode): while True: msg = await ws.receive() - if msg.tp == aiohttp.WSMsgType.text: + if msg.type == aiohttp.WSMsgType.text: out.feed_data(msg.data.encode()) - elif msg.tp == aiohttp.WSMsgType.BINARY: + elif msg.type == aiohttp.WSMsgType.BINARY: out.feed_data(msg.data) - elif msg.tp == aiohttp.WSMsgType.ERROR: - log.critical("Docker WebSocket Error: {}".format(msg.data)) + elif msg.type == aiohttp.WSMsgType.ERROR: + log.critical("Docker WebSocket Error: {}".format(ws.exception())) else: out.feed_eof() - ws.close() + await ws.close() break await self.stop()