Use RawConnection.read

Instead of accessing its reader and writer directly.

TODO: considering add `ReaderWriterCloser` interface and let connection
and stream inherit from it.
This commit is contained in:
mhchia
2019-08-20 18:09:36 +08:00
parent 0b466ddc86
commit ef476e555b
9 changed files with 22 additions and 31 deletions

View File

@ -23,7 +23,7 @@ class InsecureSession(BaseSession):
encoded_msg_bytes = encode_fixedint_prefixed(msg_bytes)
await self.write(encoded_msg_bytes)
msg_bytes_other_side = await read_fixedint_prefixed(self.reader)
msg_bytes_other_side = await read_fixedint_prefixed(self.conn)
msg_other_side = plaintext_pb2.Exchange()
msg_other_side.ParseFromString(msg_bytes_other_side)