@@ -149,7 +149,7 @@ impl<'a, T: 'static + Transport> Server<'a, T> {
149149 // EMFILE. So sleep for a while and retry
150150 // TODO: Only sleep for EMFILE, ENFILE, ENOMEM, ENOBUFS
151151 if let Some ( d) = backoff. next_backoff( ) {
152- error!( "Failed to accept: {}. Retry in {:?}..." , err, d) ;
152+ error!( "Failed to accept: {:# }. Retry in {:?}..." , err, d) ;
153153 time:: sleep( d) . await ;
154154 } else {
155155 // This branch will never be executed according to the current retry policy
@@ -172,11 +172,11 @@ impl<'a, T: 'static + Transport> Server<'a, T> {
172172 let control_channels = self . control_channels. clone( ) ;
173173 tokio:: spawn( async move {
174174 if let Err ( err) = handle_connection( conn, services, control_channels) . await {
175- error!( "{:? }" , err) ;
175+ error!( "{:# }" , err) ;
176176 }
177- } . instrument( info_span!( "handle_connection " , %addr) ) ) ;
177+ } . instrument( info_span!( "connection " , %addr) ) ) ;
178178 } , Err ( e) => {
179- error!( "{:? }" , e) ;
179+ error!( "{:# }" , e) ;
180180 }
181181 }
182182 } ,
@@ -369,7 +369,7 @@ where
369369{
370370 // Create a control channel handle, where the control channel handling task
371371 // and the connection pool task are created.
372- #[ instrument( skip_all, fields( service = %service. name) ) ]
372+ #[ instrument( name = "handle" , skip_all, fields( service = %service. name) ) ]
373373 fn new ( conn : T :: Stream , service : ServerServiceConfig ) -> ControlChannelHandle < T > {
374374 // Create a shutdown channel
375375 let ( shutdown_tx, shutdown_rx) = broadcast:: channel :: < bool > ( 1 ) ;
@@ -406,7 +406,7 @@ where
406406 . await
407407 . with_context ( || "Failed to run TCP connection pool" )
408408 {
409- error ! ( "{:? }" , e) ;
409+ error ! ( "{:# }" , e) ;
410410 }
411411 }
412412 . instrument ( Span :: current ( ) ) ,
@@ -422,7 +422,7 @@ where
422422 . await
423423 . with_context ( || "Failed to run TCP connection pool" )
424424 {
425- error ! ( "{:? }" , e) ;
425+ error ! ( "{:# }" , e) ;
426426 }
427427 }
428428 . instrument ( Span :: current ( ) ) ,
@@ -433,15 +433,14 @@ where
433433 let ch = ControlChannel :: < T > {
434434 conn,
435435 shutdown_rx,
436- service : service. clone ( ) ,
437436 data_ch_req_rx,
438437 } ;
439438
440439 // Run the control channel
441440 tokio:: spawn (
442441 async move {
443442 if let Err ( err) = ch. run ( ) . await {
444- error ! ( "{:? }" , err) ;
443+ error ! ( "{:# }" , err) ;
445444 }
446445 }
447446 . instrument ( Span :: current ( ) ) ,
@@ -458,14 +457,13 @@ where
458457// Control channel, using T as the transport layer. P is TcpStream or UdpTraffic
459458struct ControlChannel < T : Transport > {
460459 conn : T :: Stream , // The connection of control channel
461- service : ServerServiceConfig , // A copy of the corresponding service config
462460 shutdown_rx : broadcast:: Receiver < bool > , // Receives the shutdown signal
463461 data_ch_req_rx : mpsc:: UnboundedReceiver < bool > , // Receives visitor connections
464462}
465463
466464impl < T : Transport > ControlChannel < T > {
467465 // Run a control channel
468- #[ instrument( skip ( self ) , fields ( service = % self . service . name ) ) ]
466+ #[ instrument( skip_all ) ]
469467 async fn run ( mut self ) -> Result < ( ) > {
470468 let cmd = bincode:: serialize ( & ControlChannelCmd :: CreateDataChannel ) . unwrap ( ) ;
471469
@@ -476,11 +474,11 @@ impl<T: Transport> ControlChannel<T> {
476474 match val {
477475 Some ( _) => {
478476 if let Err ( e) = self . conn. write_all( & cmd) . await . with_context( ||"Failed to write control cmds" ) {
479- error!( "{:? }" , e) ;
477+ error!( "{:# }" , e) ;
480478 break ;
481479 }
482480 if let Err ( e) = self . conn. flush( ) . await . with_context( || "Failed to flush control cmds" ) {
483- error!( "{:? }" , e) ;
481+ error!( "{:# }" , e) ;
484482 break ;
485483 }
486484 }
@@ -522,7 +520,7 @@ fn tcp_listen_and_send(
522520 let l: TcpListener = match l {
523521 Ok ( v) => v,
524522 Err ( e) => {
525- error ! ( "{:? }" , e) ;
523+ error ! ( "{:# }" , e) ;
526524 return ;
527525 }
528526 } ;
0 commit comments