@@ -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())
Adds an API to explicitly disconnect a client. This can be useful for testing the auto-reconnect behavior of clients Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> --- lib/bb/asyncrpc/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)