From 0a4560be6678b63b00c05cc7cda0d1d23e7864f3 Mon Sep 17 00:00:00 2001 From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl> Date: Fri, 2 Apr 2021 20:17:40 +0200 Subject: [PATCH] Ping server only if the connection is active. --- devices/clients/opcua_connection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devices/clients/opcua_connection.py b/devices/clients/opcua_connection.py index c5fa45507..cfd8d003b 100644 --- a/devices/clients/opcua_connection.py +++ b/devices/clients/opcua_connection.py @@ -97,7 +97,10 @@ class OPCUAConnection(CommClient): ping the client to make sure the connection with the client is still functional. """ try: - self.client.send_hello() + if self.connected is True: + self.client.send_hello() + else: + self.streams.debug_stream("Will not ping OPC-UA server {} because the connection is inactive.".format(self._servername())) except Exception as e: raise Exception("Lost connection to server {}.".format(self._servername())) from e -- GitLab