Beispiel #1
0
 async def process_message(self, algohdr, seqhdr, body):
     """
     Process incoming messages.
     """
     typeid = nodeid_from_binary(body)
     requesthdr = struct_from_binary(ua.RequestHeader, body)
     _logger.debug('process_message %r %r', typeid, requesthdr)
     try:
         return await self._process_message(typeid, requesthdr, algohdr,
                                            seqhdr, body)
     except ServiceError as e:
         status = ua.StatusCode(e.code)
         response = ua.ServiceFault()
         response.ResponseHeader.ServiceResult = status
         _logger.error("sending service fault response: %s (%s)",
                       status.doc, status.name)
         self.send_response(requesthdr.RequestHandle, algohdr, seqhdr,
                            response)
         return True
     except Exception:
         _logger.exception('Error while processing message')
         response = ua.ServiceFault()
         response.ResponseHeader.ServiceResult = ua.StatusCode(
             ua.StatusCodes.BadInternalError)
         self.send_response(requesthdr.RequestHandle, algohdr, seqhdr,
                            response)
         return True
Beispiel #2
0
 async def process_message(self, seqhdr, body):
     """
     Process incoming messages.
     """
     typeid = nodeid_from_binary(body)
     requesthdr = struct_from_binary(ua.RequestHeader, body)
     _logger.debug('process_message %r %r', typeid, requesthdr)
     try:
         return await self._process_message(typeid, requesthdr, seqhdr, body)
     except ServiceError as e:
         status = ua.StatusCode(e.code)
         response = ua.ServiceFault()
         response.ResponseHeader.ServiceResult = status
         _logger.error("sending service fault response: %s (%s)", status.doc, status.name)
         self.send_response(requesthdr.RequestHandle, seqhdr, response)
         return True
     except ua.uaerrors.BadUserAccessDenied:
         if self.session:
             user = self.session.user
         else:
             user = '******'
         _logger.warning("%s attempted to do something they are not permitted to do", user)
         response = ua.ServiceFault()
         response.ResponseHeader.ServiceResult = ua.StatusCode(ua.StatusCodes.BadUserAccessDenied)
         self.send_response(requesthdr.RequestHandle, seqhdr, response)
     except Exception:
         _logger.exception('Error while processing message')
         response = ua.ServiceFault()
         response.ResponseHeader.ServiceResult = ua.StatusCode(ua.StatusCodes.BadInternalError)
         self.send_response(requesthdr.RequestHandle, seqhdr, response)
         return True