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