mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Address the telnet console bug. Add wait_for for drain() call. If we're stuck on drain then the buffer isn't getting emptied. 5 seconds after drain() blocks, exception will be thrown and client will be removed from connection table and will no longer be a problem.
This commit is contained in:
parent
d94adf4c8f
commit
763ef24108
@ -297,9 +297,17 @@ class AsyncioTelnetServer:
|
|||||||
reader_read = await self._get_reader(network_reader)
|
reader_read = await self._get_reader(network_reader)
|
||||||
|
|
||||||
# Replicate the output on all clients
|
# Replicate the output on all clients
|
||||||
for connection in self._connections.values():
|
for connection_key in list(self._connections.keys()):
|
||||||
connection.writer.write(data)
|
client_info = connection_key.get_extra_info("socket").getpeername()
|
||||||
await connection.writer.drain()
|
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):
|
async def _read(self, cmd, buffer, location, reader):
|
||||||
""" Reads next op from the buffer or reader"""
|
""" Reads next op from the buffer or reader"""
|
||||||
|
Loading…
Reference in New Issue
Block a user