Change async def write

To return `None` instead of `int. `Writer.write` *does* write all data
in all use case.
This commit is contained in:
mhchia
2020-02-07 18:33:15 +08:00
parent 1152f9b703
commit fb53edbc04
7 changed files with 10 additions and 14 deletions

View File

@ -27,8 +27,8 @@ class NoiseConnection(BaseSession):
async def read(self, n: int = None) -> bytes:
return await self.conn.read(n)
async def write(self, data: bytes) -> int:
return await self.conn.write(data)
async def write(self, data: bytes) -> None:
await self.conn.write(data)
async def close(self) -> None:
await self.conn.close()

View File

@ -135,9 +135,8 @@ class SecureSession(BaseSession):
raise DecryptionFailedException() from e
return decrypted_msg
async def write(self, data: bytes) -> int:
async def write(self, data: bytes) -> None:
await self.write_msg(data)
return len(data)
async def write_msg(self, msg: bytes) -> None:
encrypted_data = self.local_encrypter.encrypt(msg)