diff --git a/RCUSCC/RCUSCC/RCUSCC.py b/RCUSCC/RCUSCC/RCUSCC.py index d1c295a832bd593306512469286ec5d1f3062f8c..acc22c385a4c54e3f61c68c4d7fdf0fe3a533a86 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):