Catch IncompleteReadError

It can happen when the input stream closes after a timeout.
This commit is contained in:
Andrew Ferrazzutti 2021-05-04 22:00:37 -04:00
parent 6f62eb0054
commit d894eafc21
1 changed files with 3 additions and 0 deletions

View File

@ -152,6 +152,9 @@ class RPCClient:
try: try:
line += await self._reader.readuntil() line += await self._reader.readuntil()
break break
except asyncio.exceptions.IncompleteReadError as e:
line += e.partial
break
except asyncio.exceptions.LimitOverrunError as e: except asyncio.exceptions.LimitOverrunError as e:
self.log.warning(f"Buffer overrun: {e}") self.log.warning(f"Buffer overrun: {e}")
line += await self._reader.read(self._reader._limit) line += await self._reader.read(self._reader._limit)