/// The method processes timed-out requests
///
/// This method is called by the method on_timer(). It checks if there are
/// any chunk requests that timed out from the given peer and returns
/// "true" if this is the case.
The method processes timed-out requests
This method is called by the method on_timer(). It checks if there are
any chunk requests that timed out from the given peer and returns
"true" if this is the case.
The method processes timed - out requests This method is called by the method on_timer () . It checks if there are any chunk requests that timed out from the given peer and returns " true " if this is the case .
fn process_timed_out_requests(&self, node_id: &NodeId, peer_context: &mut PeerContext) -> bool {
        // Mark time-out chunks.
        let mut timed_out_chunks: Vec<_> = Vec::new();
        let mut peer_timed_out: bool = false;
        peer_context.requested.retain(|key, tracker| {
            let timed_out = tracker.requested_instant.elapsed().as_millis()
                >= self.gossip_config.max_chunk_wait_ms as u128;
            if timed_out {
                self.metrics.chunks_timed_out.inc();
                timed_out_chunks.push((
                    *node_id,
                    key.chunk_id,
                    key.artifact_id.clone(),
                    key.integrity_hash.clone(),
                ));
                peer_timed_out = true;
                trace!(
                    self.log,
                    "Chunk timeout Key {:?} Tracker {:?} elapsed{:?} requested {:?} Now {:?}",
                    key,
                    tracker,
                    tracker.requested_instant.elapsed().as_millis(),
                    tracker.requested_instant,
                    std::time::Instant::now()
                )
            }
            // Retain chunks that have not timed out.
            !timed_out
        });
        for (node_id, chunk_id, artifact_id, integrity_hash) in timed_out_chunks.into_iter() {
            self.process_timed_out_chunk(&node_id, artifact_id, integrity_hash, chunk_id)
        }
        peer_timed_out
    }
fn process_timed_out_requests ( & self , node_id : & NodeId , peer_context : & mut PeerContext ) -> bool { // Mark time-out chunks. let mut timed_out_chunks : Vec < _ > = Vec :: new ( ) ; let mut peer_timed_out : bool = false ; peer_context . requested . retain ( | key , tracker | { let timed_out = tracker . requested_instant . elapsed ( ) . as_millis ( ) >= self . gossip_config . max_chunk_wait_ms as u128 ; if timed_out { self . metrics . chunks_timed_out . inc ( ) ; timed_out_chunks . push ( ( * node_id , key . chunk_id , key . artifact_id . clone ( ) , key . integrity_hash . clone ( ) , ) ) ; peer_timed_out = true ; trace ! ( self log " " key tracker tracker requested_instant elapsed ( ) as_millis ( ) tracker requested_instant std time Instant now ( ) ) } // Retain chunks that have not timed out. ! timed_out } ) ; for ( node_id , chunk_id , artifact_id , integrity_hash ) in timed_out_chunks . into_iter ( ) { self . process_timed_out_chunk ( & node_id , artifact_id , integrity_hash , chunk_id ) } peer_timed_out }
The method processes timed-out requests
This method is called by the method on_timer().
The method processes timed - out requests This method is called by the method on_timer () .
&self
node_id
&NodeId
peer_context
&mut PeerContext