diff --git a/gns3server/utils/asyncio/telnet_server.py b/gns3server/utils/asyncio/telnet_server.py index 30526850..cadf94b0 100644 --- a/gns3server/utils/asyncio/telnet_server.py +++ b/gns3server/utils/asyncio/telnet_server.py @@ -263,9 +263,17 @@ class AsyncioTelnetServer(TelnetServer): reader_read = await self._get_reader(network_reader) # Replicate the output on all clients - for connection in self._connections.values(): - connection.writer.write(data) - await connection.writer.drain() + for connection_key in list(self._connections.keys()): + client_info = connection_key.get_extra_info("socket").getpeername() + connection = self._connections[connection_key] + + try: + connection.writer.write(data) + await asyncio.wait_for(connection.writer.drain(), timeout=10) + except: + log.debug(f"Timeout while sending data to client: {client_info}, closing and removing from connection table.") + connection.close() + del self._connections[connection_key] async def _read(self, cmd, buffer, location, reader): """ Reads next op from the buffer or reader""" diff --git a/requirements.txt b/requirements.txt index 42df6013..b7fcc153 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ jsonschema>=4.17.3,<4.18 # v4.17.3 is the last version to support Python 3.7 aiohttp>=3.8.6,<3.9; python_version == '3.7' # v3.8.6 is the last version to support Python 3.7 -aiohttp>=3.9.0,<3.10; python_version > '3.7' +aiohttp>=3.9.3,<3.10; python_version > '3.7' aiohttp-cors>=0.7.0,<0.8 aiofiles>=23.2.1,<23.3 -Jinja2>=3.1.2,<3.2 +Jinja2>=3.1.3,<3.2 sentry-sdk==1.39.2,<1.40 psutil==5.9.8 -async-timeout>=4.0.2,<4.1 +async-timeout>=4.0.3,<4.1 distro>=1.9.0 py-cpuinfo>=9.0.0,<10.0 platformdirs>=2.4.0