From: Benjamin Braatz Date: Mon, 26 May 2025 01:33:43 +0000 (+0200) Subject: Bugfix: Doesn't get out of "Reader or writer missing" state. X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=b74ebbc51870c185004afcac1e8dcfec578e2c05;p=graphit%2Fcontrolpi-graph.git Bugfix: Doesn't get out of "Reader or writer missing" state. --- diff --git a/controlpi_plugins/graph_connection.py b/controlpi_plugins/graph_connection.py index 8a9d305..1d1358e 100644 --- a/controlpi_plugins/graph_connection.py +++ b/controlpi_plugins/graph_connection.py @@ -112,4 +112,25 @@ class GraphConnection: # Return result: return response['result'] else: - raise Exception("Reader or writer missing.") + if writer is not None: + writer.close() + self.connection.closed += 1 + # Open connection: + (r, w) = await asyncio.open_connection(self.hostname, + self.port, + ssl=self.ssl) + self.connection.opened += 1 + # Read banner: + size_bytes = await r.readexactly(4) + size_int = struct.unpack('