@@ -214,47 +214,40 @@ impl ConnectionProvider for TokioConnections {
214214
215215 fn send ( & self , conn : ConnectionId , data : NonEmptyBytes ) -> BoxFuture < ' static , std:: io:: Result < ( ) > > {
216216 let resource = self . inner . clone ( ) ;
217- let len = data. len ( ) ;
218- Box :: pin (
219- async move {
220- let connection = resource
221- . connections
222- . lock ( )
223- . get ( & conn)
224- . ok_or_else ( || std:: io:: Error :: other ( format ! ( "connection {conn} not found for send" ) ) ) ?
225- . writer
226- . clone ( ) ;
227- tokio:: time:: timeout ( Duration :: from_secs ( 100 ) , connection. lock ( ) . await . write_all ( & data) ) . await ??;
228- Ok ( ( ) )
229- }
230- . instrument ( tracing:: trace_span!( "send" , %conn, len) ) ,
231- )
217+ Box :: pin ( async move {
218+ let connection = resource
219+ . connections
220+ . lock ( )
221+ . get ( & conn)
222+ . ok_or_else ( || std:: io:: Error :: other ( format ! ( "connection {conn} not found for send" ) ) ) ?
223+ . writer
224+ . clone ( ) ;
225+ tokio:: time:: timeout ( Duration :: from_secs ( 100 ) , connection. lock ( ) . await . write_all ( & data) ) . await ??;
226+ Ok ( ( ) )
227+ } )
232228 }
233229
234230 fn recv ( & self , conn : ConnectionId , bytes : NonZeroUsize ) -> BoxFuture < ' static , std:: io:: Result < NonEmptyBytes > > {
235231 let resource = self . inner . clone ( ) ;
236- Box :: pin (
237- async move {
238- let connection = resource
239- . connections
240- . lock ( )
241- . get ( & conn)
242- . ok_or_else ( || std:: io:: Error :: other ( format ! ( "connection {conn} not found for recv" ) ) ) ?
243- . reader
244- . clone ( ) ;
245- let mut guard = connection. lock ( ) . await ;
246- let ( reader, buf) = & mut * guard;
247- buf. reserve ( bytes. get ( ) - buf. remaining ( ) . min ( bytes. get ( ) ) ) ;
248- while buf. remaining ( ) < bytes. get ( ) {
249- if reader. read_buf ( buf) . await ? == 0 {
250- return Err ( std:: io:: ErrorKind :: UnexpectedEof . into ( ) ) ;
251- } ;
252- }
253- #[ expect( clippy:: expect_used) ]
254- Ok ( buf. copy_to_bytes ( bytes. get ( ) ) . try_into ( ) . expect ( "guaranteed by NonZeroUsize" ) )
232+ Box :: pin ( async move {
233+ let connection = resource
234+ . connections
235+ . lock ( )
236+ . get ( & conn)
237+ . ok_or_else ( || std:: io:: Error :: other ( format ! ( "connection {conn} not found for recv" ) ) ) ?
238+ . reader
239+ . clone ( ) ;
240+ let mut guard = connection. lock ( ) . await ;
241+ let ( reader, buf) = & mut * guard;
242+ buf. reserve ( bytes. get ( ) - buf. remaining ( ) . min ( bytes. get ( ) ) ) ;
243+ while buf. remaining ( ) < bytes. get ( ) {
244+ if reader. read_buf ( buf) . await ? == 0 {
245+ return Err ( std:: io:: ErrorKind :: UnexpectedEof . into ( ) ) ;
246+ } ;
255247 }
256- . instrument ( tracing:: trace_span!( "recv" , %conn, bytes) ) ,
257- )
248+ #[ expect( clippy:: expect_used) ]
249+ Ok ( buf. copy_to_bytes ( bytes. get ( ) ) . try_into ( ) . expect ( "guaranteed by NonZeroUsize" ) )
250+ } )
258251 }
259252
260253 fn close ( & self , conn : ConnectionId ) -> BoxFuture < ' static , std:: io:: Result < ( ) > > {
0 commit comments