From c785c763fe4912f878c900f9ada894ed40fa48c2 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Mon, 8 Jul 2024 22:54:58 +0200 Subject: [PATCH] afws_client: asyncio fixes --- artiq/frontend/afws_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/artiq/frontend/afws_client.py b/artiq/frontend/afws_client.py index 6351f761d..d8874c2c4 100755 --- a/artiq/frontend/afws_client.py +++ b/artiq/frontend/afws_client.py @@ -72,11 +72,11 @@ class Client: async def close(self): if self.writer: - await self.writer.close() + self.writer.close() await self.writer.wait_closed() async def send_command(self, *command): - await self.writer.write((" ".join(command) + "\n").encode()) + self.writer.write((" ".join(command) + "\n").encode()) async def read_line(self): return (await self.reader.readline()).decode("ascii") @@ -120,7 +120,7 @@ class Client: if status != "done": return status, None print("Build completed. Downloading...") - reply, length = self.read_reply() + reply, length = await self.read_reply() if reply != "PRODUCT": raise ValueError("Unexpected server reply: expected 'PRODUCT', got '{}'".format(reply)) length = int(length) @@ -129,7 +129,7 @@ class Client: total = 0 while total != length: chunk_len = min(4096, length-total) - contents += self.fsocket.read(chunk_len) + contents += await self.reader.read(chunk_len) total += chunk_len progress_bar.update(chunk_len) print("Download completed.")