mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
bitbake: asyncrpc: client: Add disconnect API
Adds an API to explicitly disconnect a client. This can be useful for testing the auto-reconnect behavior of clients (Bitbake rev: cb2fec7eaca20608faf4b8ff11ec8590ac7f2229) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
66bcf57bfe
commit
6e67b000ef
@@ -67,11 +67,14 @@ class AsyncClient(object):
|
||||
self.socket = await self._connect_sock()
|
||||
await self.setup_connection()
|
||||
|
||||
async def close(self):
|
||||
async def disconnect(self):
|
||||
if self.socket is not None:
|
||||
await self.socket.close()
|
||||
self.socket = None
|
||||
|
||||
async def close(self):
|
||||
await self.disconnect()
|
||||
|
||||
async def _send_wrapper(self, proc):
|
||||
count = 0
|
||||
while True:
|
||||
@@ -160,6 +163,9 @@ class Client(object):
|
||||
def max_chunk(self, value):
|
||||
self.client.max_chunk = value
|
||||
|
||||
def disconnect(self):
|
||||
self.loop.run_until_complete(self.client.close())
|
||||
|
||||
def close(self):
|
||||
if self.loop:
|
||||
self.loop.run_until_complete(self.client.close())
|
||||
|
||||
Reference in New Issue
Block a user