From 860ca3b35d3f130c958863c871c1312af6c8f3a5 Mon Sep 17 00:00:00 2001 From: ziajka Date: Mon, 20 Nov 2017 15:28:07 +0100 Subject: [PATCH] Remotely close telnet console. Ref #2330 --- gns3server/compute/dynamips/nodes/ethernet_switch.py | 3 ++- gns3server/utils/asyncio/telnet_server.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gns3server/compute/dynamips/nodes/ethernet_switch.py b/gns3server/compute/dynamips/nodes/ethernet_switch.py index 1df65caf..6d044bcd 100644 --- a/gns3server/compute/dynamips/nodes/ethernet_switch.py +++ b/gns3server/compute/dynamips/nodes/ethernet_switch.py @@ -215,7 +215,8 @@ class EthernetSwitch(Device): Deletes this Ethernet switch. """ yield from self._telnet.close() - + self._telnet_server.close() + for nio in self._nios.values(): if nio: yield from nio.close() diff --git a/gns3server/utils/asyncio/telnet_server.py b/gns3server/utils/asyncio/telnet_server.py index 0f4bc3c1..782b12ae 100644 --- a/gns3server/utils/asyncio/telnet_server.py +++ b/gns3server/utils/asyncio/telnet_server.py @@ -212,7 +212,8 @@ class AsyncioTelnetServer: @asyncio.coroutine def close(self): for writer, connection in self._connections.items(): - connection.close() + writer.write_eof() + yield from writer.drain() @asyncio.coroutine def client_connected_hook(self):