fn drop_cancelled(&mut self, cx: &mut Context<'_>) {
        let mut canceled = HashMap::<u16, ProtoError>::new();
        for (&id, ref mut active_req) in &mut self.active_requests {
            if active_req.is_canceled() {
                canceled.insert(id, ProtoError::from("requestor canceled"));
            }

            // check for timeouts...
            match active_req.poll_timeout(cx) {
                Poll::Ready(()) => {
                    debug!("request timed out: {}", id);
                    canceled.insert(id, ProtoError::from(ProtoErrorKind::Timeout));
                }
                Poll::Pending => (),
            }
        }

        // drop all the canceled requests
        for (id, error) in canceled {
            if let Some(active_request) = self.active_requests.remove(&id) {
                if active_request.responses.is_empty() {
                    // complete the request, it's failed...
                    active_request.complete_with_error(error);
                } else {
                    // this is a timeout waiting for multiple responses...
                    active_request.complete();
                }
            }
        }
    }
/// loop over active_requests and remove cancelled requests
///  this should free up space if we already had 4096 active requests
loop over active_requests and remove cancelled requests
this should free up space if we already had 4096 active requests
loop over active_requests and remove cancelled requests this should free up space if we already had 4096 active requests
fn drop_cancelled(&mut self, cx: &mut Context<'_>) {
        let mut canceled = HashMap::<u16, ProtoError>::new();
        for (&id, ref mut active_req) in &mut self.active_requests {
            if active_req.is_canceled() {
                canceled.insert(id, ProtoError::from("requestor canceled"));
            }
            // check for timeouts...
            match active_req.poll_timeout(cx) {
                Poll::Ready(()) => {
                    debug!("request timed out: {}", id);
                    canceled.insert(id, ProtoError::from(ProtoErrorKind::Timeout));
                }
                Poll::Pending => (),
            }
        }
        // drop all the canceled requests
        for (id, error) in canceled {
            if let Some(active_request) = self.active_requests.remove(&id) {
                if active_request.responses.is_empty() {
                    // complete the request, it's failed...
                    active_request.complete_with_error(error);
                } else {
                    // this is a timeout waiting for multiple responses...
                    active_request.complete();
                }
            }
        }
    }
fn drop_cancelled ( & mut self , cx : & mut Context < ' _ > ) { let mut canceled = HashMap :: < u16 , ProtoError > :: new ( ) ; for ( & id , ref mut active_req ) in & mut self . active_requests { if active_req . is_canceled ( ) { canceled . insert ( id , ProtoError :: from ( " " ) ) ; } // check for timeouts... match active_req . poll_timeout ( cx ) { Poll :: Ready ( ( ) ) => { debug ! ( " " id ) ; canceled . insert ( id , ProtoError :: from ( ProtoErrorKind :: Timeout ) ) ; } Poll :: Pending => ( ) , } } // drop all the canceled requests for ( id , error ) in canceled { if let Some ( active_request ) = self . active_requests . remove ( & id ) { if active_request . responses . is_empty ( ) { // complete the request, it's failed... active_request . complete_with_error ( error ) ; } else { // this is a timeout waiting for multiple responses... active_request . complete ( ) ; } } } }
loop over active_requests and remove cancelled requests
this should free up space if we already had 4096 active requests
loop over active_requests and remove cancelled requests this should free up space if we already had 4096 active requests
&mut self
cx
&mut Context<'_>
&mut self
cx
&mut Context<'_>