make stream close async

This commit is contained in:
Christophe de Carvalho Pereira Martins
2018-11-18 17:22:17 +01:00
parent 01daf8ae8a
commit 96edf96e76
3 changed files with 10 additions and 6 deletions

View File

@ -83,8 +83,12 @@ class MuxedConn(IMuxedConn):
# << by 3, then or with flag
header = (stream_id << 3) | flag
header = encode_uvarint(header)
data_length = encode_uvarint(len(data))
_bytes = header + data_length + data
if data is None:
data_length = encode_uvarint(0)
_bytes = header + data_length
else:
data_length = encode_uvarint(len(data))
_bytes = header + data_length + data
return await self.write_to_stream(_bytes)