Add lock to RawConnection

To avoid `self.writer.drain()` is called in parallel.
Reference: https://bugs.python.org/issue29930
This commit is contained in:
mhchia
2019-08-20 17:09:38 +08:00
parent 5768daa9bf
commit 0b466ddc86
5 changed files with 37 additions and 27 deletions

View File

@ -150,8 +150,7 @@ class Mplex(IMuxedConn):
:param _bytes: byte array to write
:return: length written
"""
self.conn.writer.write(_bytes)
await self.conn.writer.drain()
await self.conn.write(_bytes)
return len(_bytes)
async def handle_incoming(self) -> None: