def close_session(self, deletesubscriptions): self.logger.info("close_session") request = ua.CloseSessionRequest() request.DeleteSubscriptions = deletesubscriptions data = self._uasocket.send_request(request) response = ua.CloseSessionResponse.from_binary(data) try: response.ResponseHeader.ServiceResult.check() except BadSessionClosed: # Problem: closing the session with open publish requests leads to BadSessionClosed responses # we can just ignore it therefore. # Alternatively we could make sure that there are no publish requests in flight when # closing the session. pass
def close_session(self, deletesubscriptions): self.logger.info("close_session") # Bail out if we don't have an open server-channel to unsubscribe ourself. if not self._uasocket.is_secure_channel_open(): return request = ua.CloseSessionRequest() request.DeleteSubscriptions = deletesubscriptions data = self._uasocket.send_request(request) response = struct_from_binary(ua.CloseSessionResponse, data) try: response.ResponseHeader.ServiceResult.check() except BadSessionClosed: # Problem: closing the session with open publish requests leads to BadSessionClosed responses # we can just ignore it therefore. # Alternatively we could make sure that there are no publish requests in flight when # closing the session. pass
def close_session(self, deletesubscriptions): self.logger.info("close_session") request = ua.CloseSessionRequest() request.DeleteSubscriptions = deletesubscriptions data = self._uasocket.send_request(request) ua.CloseSessionResponse.from_binary(data)