def receive_request(self, request):
        """
        Handle duplicates and store received messages.

        :type request: Request
        :param request: the incoming request
        :rtype : Transaction
        :return: the edited transaction
        """
        logger.debug("receive_request - " + str(request))
        try:
            host, port = request.source
        except AttributeError:
            return
        key_mid = str_append_hash(host, port, request.mid)
        key_token = str_append_hash(host, port, request.token)

        if key_mid in list(self._transactions.keys()):
            # Duplicated
            self._transactions[key_mid].request.duplicated = True
            transaction = self._transactions[key_mid]
        else:
            request.timestamp = time.time()
            transaction = Transaction(request=request, timestamp=request.timestamp)
            with transaction:
                self._transactions[key_mid] = transaction
                self._transactions_token[key_token] = transaction
        return transaction
def receive_request ( self , request ) : logger . debug ( "receive_request - " + str ( request ) ) try : host , port = request . source except AttributeError : return key_mid = str_append_hash ( host , port , request . mid ) key_token = str_append_hash ( host , port , request . token ) if key_mid in list ( self . _transactions . keys ( ) ) : self . _transactions [ key_mid ] . request . duplicated = True transaction = self . _transactions [ key_mid ] else : request . timestamp = time . time ( ) transaction = Transaction ( request = request , timestamp = request . timestamp ) with transaction : self . _transactions [ key_mid ] = transaction self . _transactions_token [ key_token ] = transaction return transaction
Handle duplicates and store received messages.

        :type request: Request
        :param request: the incoming request
        :rtype : Transaction
        :return: the edited transaction