pub fn call(self, server: SocketAddr, request: T::Req) -> Response<T::Res> {
        if !self
            .options
            .is_allowable_queue_len(&self.service.metrics, server)
        {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("too long transmit queue"));
            return Response::error(e.into());
        }

        let header = MessageHeader {
            id: MessageId(0), // dummy
            procedure: T::ID,
            priority: self.options.priority,
            is_async: T::enable_async_request(&request),
        };

        let (handler, response) = ResponseHandler::new(
            self.decoder,
            self.options.timeout,
            Arc::clone(&self.service.metrics),
            T::NAME,
        );

        let message = Message {
            message: OutgoingMessage {
                header,
                payload: OutgoingMessagePayload::with_item(self.encoder, request),
            },
            response_handler: Some(Box::new(handler)),
            force_wakeup: self.options.force_wakeup,
        };

        if !self.service.send_message(server, message) {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("client service or server is unavailable"));
            return Response::error(e.into());
        }
        self.service.metrics.requests.increment();
        response
    }
/// Sends the request message to the RPC server,
/// and returns a future that represents the response from the server.
Sends the request message to the RPC server,
and returns a future that represents the response from the server.
Sends the request message to the RPC server and returns a future that represents the response from the server .
pub fn call(self, server: SocketAddr, request: T::Req) -> Response<T::Res> {
        if !self
            .options
            .is_allowable_queue_len(&self.service.metrics, server)
        {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("too long transmit queue"));
            return Response::error(e.into());
        }
        let header = MessageHeader {
            id: MessageId(0), // dummy
            procedure: T::ID,
            priority: self.options.priority,
            is_async: T::enable_async_request(&request),
        };
        let (handler, response) = ResponseHandler::new(
            self.decoder,
            self.options.timeout,
            Arc::clone(&self.service.metrics),
            T::NAME,
        );
        let message = Message {
            message: OutgoingMessage {
                header,
                payload: OutgoingMessagePayload::with_item(self.encoder, request),
            },
            response_handler: Some(Box::new(handler)),
            force_wakeup: self.options.force_wakeup,
        };
        if !self.service.send_message(server, message) {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("client service or server is unavailable"));
            return Response::error(e.into());
        }
        self.service.metrics.requests.increment();
        response
    }
pub fn call ( self , server : SocketAddr , request : T :: Req ) -> Response < T :: Res > { if ! self . options . is_allowable_queue_len ( & self . service . metrics , server ) { self . service . metrics . discarded_outgoing_messages . increment ( ) ; let e = track ! ( ErrorKind Unavailable cause ( " " ) ) ; return Response :: error ( e . into ( ) ) ; } let header = MessageHeader { id : MessageId ( 0 ) , // dummy procedure : T :: ID , priority : self . options . priority , is_async : T :: enable_async_request ( & request ) , } ; let ( handler , response ) = ResponseHandler :: new ( self . decoder , self . options . timeout , Arc :: clone ( & self . service . metrics ) , T :: NAME , ) ; let message = Message { message : OutgoingMessage { header , payload : OutgoingMessagePayload :: with_item ( self . encoder , request ) , } , response_handler : Some ( Box :: new ( handler ) ) , force_wakeup : self . options . force_wakeup , } ; if ! self . service . send_message ( server , message ) { self . service . metrics . discarded_outgoing_messages . increment ( ) ; let e = track ! ( ErrorKind Unavailable cause ( " " ) ) ; return Response :: error ( e . into ( ) ) ; } self . service . metrics . requests . increment ( ) ; response }
Sends the request message to the RPC server,
and returns a future that represents the response from the server.
Sends the request message to the RPC server and returns a future that represents the response from the server .
self
server
SocketAddr
request
T::Req
self
server
SocketAddr
request
T::Req