Avoid consuming 100% of CPU when stopping docker container

Fix #427
This commit is contained in:
Julien Duponchelle
2016-02-19 17:53:17 +01:00
parent f4f9e6eba6
commit f35c742b07
3 changed files with 10 additions and 9 deletions

View File

@ -125,13 +125,14 @@ class AsyncioTelnetServer:
return_when=asyncio.FIRST_COMPLETED)
for coro in done:
data = coro.result()
# Console is closed
if len(data) == 0:
raise ConnectionResetError()
if coro == network_read:
network_read = asyncio.async(network_reader.read(READ_SIZE))
# Remote console is closed
if len(data) == 0:
raise ConnectionResetError()
if IAC in data:
data = yield from self._IAC_parser(data, network_reader, network_writer)
if self._writer: