def _check_answer(self, data, context): data = data.copy(50) # FIXME check max length nodeid + responseheader typeid = ua.NodeId.from_binary(data) if typeid == ua.FourByteNodeId( ua.ObjectIds.ServiceFault_Encoding_DefaultBinary): self.logger.warning("ServiceFault from server received %s", context) hdr = ua.ResponseHeader.from_binary(data) hdr.ServiceResult.check()
def check_answer(self, data, context): data = data.copy() typeid = ua.NodeId.from_binary(data) if typeid == ua.FourByteNodeId( ua.ObjectIds.ServiceFault_Encoding_DefaultBinary): self.logger.warning("ServiceFault from server received %s", context) hdr = ua.ResponseHeader.from_binary(data) hdr.ServiceResult.check() return False return True
def run(self): self.logger.debug( "starting keepalive thread with period of %s milliseconds", self.timeout) server_state = self.client.get_node( ua.FourByteNodeId(ua.ObjectIds.Server_ServerStatus_State)) while not self._dostop: with self._cond: self._cond.wait(self.timeout / 1000) if self._dostop: break self.logger.debug("renewing channel") self.client.open_secure_channel(renew=True) val = server_state.get_value() self.logger.debug("server state is: %s ", val) self.logger.debug("keepalive thread has stopped")