@@ -159,24 +159,6 @@ impl<S: Service, C: ServiceEndpoint<S>> RpcServer<S, C> {
159159 Ok ( Accepting { send, recv } )
160160 }
161161
162- /// Accepts a new channel from a client, and reads the first request.
163- ///
164- /// The return value is a tuple of `(request, channel)`. Here `request` is the
165- /// first request which is already read from the stream. The `channel` is a
166- /// [RpcChannel] that has `sink` and `stream` fields that can be used to send more
167- /// requests and/or receive more responses.
168- ///
169- /// Often sink and stream will wrap an an underlying byte stream. In this case you can
170- /// call into_inner() on them to get it back to perform byte level reads and writes.
171- ///
172- /// Note that this method is not cancellation safe. If the future is dropped, a request
173- /// might be lost. So do not use this inside a select! block.
174- pub async fn accept_and_read_first (
175- & self ,
176- ) -> result:: Result < ( S :: Req , RpcChannel < S , C > ) , RpcServerError < C > > {
177- self . accept ( ) . await ?. read_first ( ) . await
178- }
179-
180162 /// Get the underlying service endpoint
181163 pub fn into_inner ( self ) -> C {
182164 self . source
@@ -341,7 +323,7 @@ where
341323{
342324 let server = RpcServer :: < S , C > :: new ( conn) ;
343325 loop {
344- let ( req, chan) = server. accept_and_read_first ( ) . await ?;
326+ let ( req, chan) = server. accept ( ) . await ? . read_first ( ) . await ?;
345327 let target = target. clone ( ) ;
346328 handler ( chan, req, target) . await ?;
347329 }
0 commit comments