pub fn fail(&mut self, error: curl::Error) {
        debug_assert!(self.state.error.fill(error).is_ok());

        // If the future has not been completed yet, complete it with the given error.
        if let Some(future) = self.future.take() {
            let error = self.state.error.borrow().unwrap().clone().into();

            if future.send(Err(error)).is_err() {
                debug!("future was canceled, canceling the request");
                if let Some(agent) = self.state.agent.borrow() {
                    if let Some(token) = self.state.token.get() {
                        debug_assert!(agent.cancel_request(token).is_ok());
                    }
                }
            }
        }

        self.state.close();
        self.state.read_waker.wake();
    }
/// Fail the request with the given error.
Fail the request with the given error.
Fail the request with the given error .
pub fn fail(&mut self, error: curl::Error) {
        debug_assert!(self.state.error.fill(error).is_ok());
        // If the future has not been completed yet, complete it with the given error.
        if let Some(future) = self.future.take() {
            let error = self.state.error.borrow().unwrap().clone().into();
            if future.send(Err(error)).is_err() {
                debug!("future was canceled, canceling the request");
                if let Some(agent) = self.state.agent.borrow() {
                    if let Some(token) = self.state.token.get() {
                        debug_assert!(agent.cancel_request(token).is_ok());
                    }
                }
            }
        }
        self.state.close();
        self.state.read_waker.wake();
    }
pub fn fail ( & mut self , error : curl :: Error ) { debug_assert ! ( self state error fill ( error ) is_ok ( ) ) ; // If the future has not been completed yet, complete it with the given error. if let Some ( future ) = self . future . take ( ) { let error = self . state . error . borrow ( ) . unwrap ( ) . clone ( ) . into ( ) ; if future . send ( Err ( error ) ) . is_err ( ) { debug ! ( " " ) ; if let Some ( agent ) = self . state . agent . borrow ( ) { if let Some ( token ) = self . state . token . get ( ) { debug_assert ! ( agent cancel_request ( token ) is_ok ( ) ) ; } } } } self . state . close ( ) ; self . state . read_waker . wake ( ) ; }
Fail the request with the given error.
Fail the request with the given error .
&mut self
error
curl::Error
&mut self
error
curl::Error