From 4917708f1fa46a04404c0c4dae14ddeb2e5eb56b Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Thu, 3 Dec 2020 16:55:36 +0100 Subject: [PATCH] Explicitly disconnect when not being able to send_hello, as technically we may not have disconnected. --- RCUSCC/RCUSCC/RCUSCC.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RCUSCC/RCUSCC/RCUSCC.py b/RCUSCC/RCUSCC/RCUSCC.py index d1c295a83..acc22c385 100644 --- a/RCUSCC/RCUSCC/RCUSCC.py +++ b/RCUSCC/RCUSCC/RCUSCC.py @@ -101,6 +101,7 @@ class OPCUAConnection(Thread): except socket.error as e: self.streams.error_stream("Could not connect to server %s: %s", self._servername(), e) + # signal that we're disconnected self.fault_func() return False @@ -124,6 +125,10 @@ class OPCUAConnection(Thread): except Exception as e: self.streams.error_stream("Lost connection to server %s: %s", self._servername(), e) + # technically, we may not have dropped the connection, but encounter a different error. so explicitly disconnect. + self.try_disconnect() + + # signal that we're disconnected self.fault_func() def stop(self): -- GitLab