fn on_retransmission_request(
        &self,
        gossip_re_request: &GossipRetransmissionRequest,
        peer_id: NodeId,
    ) -> P2PResult<()> {
        const BUSY_ERR: P2PResult<()> = Err(P2PError {
            p2p_error_code: P2PErrorCode::Busy,
        });
        // Throttle processing of incoming re-transmission request
        self.current_peers
            .lock()
            .unwrap()
            .get_mut(&peer_id)
            .ok_or_else(|| {
                warn!(self.log, "Can't find peer context for peer: {:?}", peer_id);
                P2PError {
                    p2p_error_code: P2PErrorCode::NotFound,
                }
            })
            .map_or_else(Err, |peer_context| {
                let elapsed_ms = peer_context
                    .last_retransmission_request_processed_time
                    .elapsed()
                    .as_millis();
                if elapsed_ms < self.gossip_config.retransmission_request_ms as u128 {
                    BUSY_ERR
                } else {
                    peer_context.last_retransmission_request_processed_time = Instant::now();
                    Ok(())
                }
            })?;

        // A retransmission request was received from a peer.
        // The send queues are cleared and a response is sent containing all the adverts
        // that satisfy the filter.
        self.transport
            .clear_send_queues(self.transport_client_type, &peer_id);

        let adverts = self
            .artifact_manager
            .get_all_validated_by_filter(&gossip_re_request.filter)
            .into_iter();

        adverts.for_each(|advert| self.send_advert_to_peer_list(advert, vec![peer_id]));
        Ok(())
    }
/// The method reacts to a retransmission request.
The method reacts to a retransmission request.
The method reacts to a retransmission request .
fn on_retransmission_request(
        &self,
        gossip_re_request: &GossipRetransmissionRequest,
        peer_id: NodeId,
    ) -> P2PResult<()> {
        const BUSY_ERR: P2PResult<()> = Err(P2PError {
            p2p_error_code: P2PErrorCode::Busy,
        });
        // Throttle processing of incoming re-transmission request
        self.current_peers
            .lock()
            .unwrap()
            .get_mut(&peer_id)
            .ok_or_else(|| {
                warn!(self.log, "Can't find peer context for peer: {:?}", peer_id);
                P2PError {
                    p2p_error_code: P2PErrorCode::NotFound,
                }
            })
            .map_or_else(Err, |peer_context| {
                let elapsed_ms = peer_context
                    .last_retransmission_request_processed_time
                    .elapsed()
                    .as_millis();
                if elapsed_ms < self.gossip_config.retransmission_request_ms as u128 {
                    BUSY_ERR
                } else {
                    peer_context.last_retransmission_request_processed_time = Instant::now();
                    Ok(())
                }
            })?;
        // A retransmission request was received from a peer.
        // The send queues are cleared and a response is sent containing all the adverts
        // that satisfy the filter.
        self.transport
            .clear_send_queues(self.transport_client_type, &peer_id);
        let adverts = self
            .artifact_manager
            .get_all_validated_by_filter(&gossip_re_request.filter)
            .into_iter();
        adverts.for_each(|advert| self.send_advert_to_peer_list(advert, vec![peer_id]));
        Ok(())
    }
fn on_retransmission_request ( & self , gossip_re_request : & GossipRetransmissionRequest , peer_id : NodeId , ) -> P2PResult < ( ) > { const BUSY_ERR : P2PResult < ( ) > = Err ( P2PError { p2p_error_code : P2PErrorCode :: Busy , } ) ; // Throttle processing of incoming re-transmission request self . current_peers . lock ( ) . unwrap ( ) . get_mut ( & peer_id ) . ok_or_else ( | | { warn ! ( self log " " peer_id ) ; P2PError { p2p_error_code : P2PErrorCode :: NotFound , } } ) . map_or_else ( Err , | peer_context | { let elapsed_ms = peer_context . last_retransmission_request_processed_time . elapsed ( ) . as_millis ( ) ; if elapsed_ms < self . gossip_config . retransmission_request_ms as u128 { BUSY_ERR } else { peer_context . last_retransmission_request_processed_time = Instant :: now ( ) ; Ok ( ( ) ) } } ) ? ; // A retransmission request was received from a peer. // The send queues are cleared and a response is sent containing all the adverts // that satisfy the filter. self . transport . clear_send_queues ( self . transport_client_type , & peer_id ) ; let adverts = self . artifact_manager . get_all_validated_by_filter ( & gossip_re_request . filter ) . into_iter ( ) ; adverts . for_each ( | advert | self . send_advert_to_peer_list ( advert , vec ! [ peer_id ] ) ) ; Ok ( ( ) ) }
The method reacts to a retransmission request.
The method reacts to a retransmission request .
&self
gossip_re_request
&GossipRetransmissionRequest
peer_id
NodeId
&self
gossip_re_request
&GossipRetransmissionRequest
peer_id
NodeId