def __handle_known_solicited(self, msg):
        """returns True if message has been handled as a solicited response"""
        with self.__requests:
            try:
                req = self.__requests[msg[M_CLIENTREF]]
            except KeyError:
                return False

            if self.__handle_low_seq_resend(msg, req):
                return True

            perform_cb = finish = False
            if msg[M_TYPE] not in _RSP_NO_REF:
                self.__update_existing(msg, req)
                # Finalise request if applicable (not marked as finished here so can perform callback first below)
                if msg[M_TYPE] in _RSP_TYPE_FINISH:
                    finish = True
                    # Exception - DUPLICATED also should produce callback
                    perform_cb = (msg[M_TYPE] == E_DUPLICATED)
                elif msg[M_TYPE] not in _RSP_TYPE_ONGOING:
                    perform_cb = True
            else:
                logger.warning('Reference unexpected for request %s of type %s', msg[M_CLIENTREF],
                               msg[M_TYPE])

        # outside lock to avoid deadlock if callbacks try to perform request-related functions
        if perform_cb:
            self.__perform_unsolicited_callbacks(msg)

        # mark request as finished
        if finish:
            req.success = msg[M_TYPE] in _RSP_TYPE_SUCCESS
            req.payload = msg[M_PAYLOAD]
            self.__clear_references(req)
            # Serialise completion of CRUD requests (together with CREATED, DELETED, etc. messages)
            if req.is_crud:
                self.__crud_threadpool.submit(req._set)
            else:
                req._set()

        return True
def __handle_known_solicited ( self , msg ) : with self . __requests : try : req = self . __requests [ msg [ M_CLIENTREF ] ] except KeyError : return False if self . __handle_low_seq_resend ( msg , req ) : return True perform_cb = finish = False if msg [ M_TYPE ] not in _RSP_NO_REF : self . __update_existing ( msg , req ) if msg [ M_TYPE ] in _RSP_TYPE_FINISH : finish = True perform_cb = ( msg [ M_TYPE ] == E_DUPLICATED ) elif msg [ M_TYPE ] not in _RSP_TYPE_ONGOING : perform_cb = True else : logger . warning ( 'Reference unexpected for request %s of type %s' , msg [ M_CLIENTREF ] , msg [ M_TYPE ] ) if perform_cb : self . __perform_unsolicited_callbacks ( msg ) if finish : req . success = msg [ M_TYPE ] in _RSP_TYPE_SUCCESS req . payload = msg [ M_PAYLOAD ] self . __clear_references ( req ) if req . is_crud : self . __crud_threadpool . submit ( req . _set ) else : req . _set ( ) return True
returns True if message has been handled as a solicited response