/// Abort an rpc call before handler is called.
Abort an rpc call before handler is called.
Abort an rpc call before handler is called .
pub fn abort(self, status: &RpcStatus) {
        match self.cq.borrow() {
            // Queue is shutdown, ignore.
            Err(Error::QueueShutdown) => return,
            Err(e) => panic!("unexpected error when aborting call: {:?}", e),
            _ => {}
        }
        let call_ptr = self.call;
        let tag = CallTag::abort(self);
        let (batch_ptr, tag_ptr) = box_batch_tag(tag);
        let code = unsafe {
            let details_ptr = status
                .details
                .as_ref()
                .map_or_else(ptr::null, |s| s.as_ptr() as _);
            let details_len = status.details.as_ref().map_or(0, String::len);
            grpc_sys::grpcwrap_call_send_status_from_server(
                call_ptr,
                batch_ptr,
                status.status,
                details_ptr,
                details_len,
                ptr::null_mut(),
                1,
                ptr::null(),
                0,
                0,
                tag_ptr as *mut c_void,
            )
        };
        if code != GrpcCallStatus::Ok {
            unsafe {
                Box::from_raw(tag_ptr);
            }
            panic!("create call fail: {:?}", code);
        }
    }
pub fn abort ( self , status : & RpcStatus ) { match self . cq . borrow ( ) { // Queue is shutdown, ignore. Err ( Error :: QueueShutdown ) => return , Err ( e ) => panic ! ( " " e ) , _ => { } } let call_ptr = self . call ; let tag = CallTag :: abort ( self ) ; let ( batch_ptr , tag_ptr ) = box_batch_tag ( tag ) ; let code = unsafe { let details_ptr = status . details . as_ref ( ) . map_or_else ( ptr :: null , | s | s . as_ptr ( ) as _ ) ; let details_len = status . details . as_ref ( ) . map_or ( 0 , String :: len ) ; grpc_sys :: grpcwrap_call_send_status_from_server ( call_ptr , batch_ptr , status . status , details_ptr , details_len , ptr :: null_mut ( ) , 1 , ptr :: null ( ) , 0 , 0 , tag_ptr as * mut c_void , ) } ; if code != GrpcCallStatus :: Ok { unsafe { Box :: from_raw ( tag_ptr ) ; } panic ! ( " " code ) ; } }
Abort an rpc call before handler is called.
Abort an rpc call before handler is called .
self
status
&RpcStatus