Fix server's control session reading from socket; improve docstrings

This commit is contained in:
2022-05-07 14:44:43 +02:00
parent 72e380cd77
commit 5a72a6d1d1
5 changed files with 17 additions and 9 deletions
+2
View File
@@ -85,6 +85,7 @@ class ControlClient(ABC):
"""
self._connected = True
writer.write(json.dumps(self._client_info()).encode())
writer.write(b'\n')
await writer.drain()
print("Connected to", (await reader.read(SESSION_MSG_BYTES)).decode())
print("Type '-h' to get help and usage instructions for all available commands.\n")
@@ -131,6 +132,7 @@ class ControlClient(ABC):
try:
# Send the command to the server.
writer.write(cmd.encode())
writer.write(b'\n')
await writer.drain()
except ConnectionError as e:
self._connected = False