safer disconnect sequence
This commit is contained in:
parent
1b72f94043
commit
cf35e2cf24
1 changed files with 5 additions and 2 deletions
|
@ -109,8 +109,11 @@ class Dispatcher:
|
|||
await asyncio.gather(self._writer, self._reader)
|
||||
self._logger.debug("Net workers stopped")
|
||||
if self._up:
|
||||
if self._up.can_write_eof():
|
||||
if not self._up.is_closing() and self._up.can_write_eof():
|
||||
try:
|
||||
self._up.write_eof()
|
||||
except OSError as e:
|
||||
self._logger.error("Could not write EOF : %s", str(e))
|
||||
self._up.close()
|
||||
if block:
|
||||
await self._up.wait_closed()
|
||||
|
|
Loading…
Reference in a new issue