Add disconnect method to sender

Unlike Rust, there's no implicit dropping of connections.
This commit is contained in:
Lonami Exo 2023-09-01 11:46:49 +02:00
parent 5a34e65708
commit fb4503338d

View File

@ -120,6 +120,10 @@ class Sender:
Enqueuer(request_queue), Enqueuer(request_queue),
) )
async def disconnect(self):
self._writer.close()
await self._writer.wait_closed()
async def invoke(self, request: RemoteCall[Return]) -> bytes: async def invoke(self, request: RemoteCall[Return]) -> bytes:
rx = self._enqueue_body(bytes(request)) rx = self._enqueue_body(bytes(request))
return await self._step_until_receive(rx) return await self._step_until_receive(rx)