@@ -365,21 +365,26 @@ where
365365 // Note: This can't possibly be fulfilled until the 101 response
366366 // is returned below, so it's better to spawn this future instead
367367 // waiting for it to complete to then return a response.
368- tokio:: task:: spawn ( async move {
369- match hyper:: upgrade:: on ( & mut req) . await {
370- Ok ( upgraded) => {
371- if let Err ( e) =
372- derp_connection_handler ( & closure_conn_handler, upgraded) . await
373- {
374- tracing:: warn!(
375- "server \" {HTTP_UPGRADE_PROTOCOL}\" io error: {:?}" ,
376- e
377- )
378- } ;
368+ tokio:: task:: spawn (
369+ async move {
370+ match hyper:: upgrade:: on ( & mut req) . await {
371+ Ok ( upgraded) => {
372+ if let Err ( e) =
373+ derp_connection_handler ( & closure_conn_handler, upgraded) . await
374+ {
375+ tracing:: warn!(
376+ "server \" {HTTP_UPGRADE_PROTOCOL}\" io error: {:?}" ,
377+ e
378+ ) ;
379+ } else {
380+ tracing:: info!( "server \" {HTTP_UPGRADE_PROTOCOL}\" success" ) ;
381+ } ;
382+ }
383+ Err ( e) => tracing:: warn!( "upgrade error: {:?}" , e) ,
379384 }
380- Err ( e) => tracing:: warn!( "upgrade error: {:?}" , e) ,
381385 }
382- } ) ;
386+ . instrument ( tracing:: debug_span!( "derp_connection_handler" ) ) ,
387+ ) ;
383388
384389 // Now return a 101 Response saying we agree to the upgrade to the
385390 // HTTP_UPGRADE_PROTOCOL
@@ -514,6 +519,7 @@ impl DerpService {
514519 match tls_config {
515520 Some ( tls_config) => self . tls_serve_connection ( stream, tls_config) . await ,
516521 None => {
522+ debug ! ( "HTTP: serve connection" ) ;
517523 self . serve_connection ( MaybeTlsStreamServer :: Plain ( stream) )
518524 . await
519525 }
@@ -526,18 +532,25 @@ impl DerpService {
526532 match acceptor {
527533 TlsAcceptor :: LetsEncrypt ( a) => match a. accept ( stream) . await ? {
528534 None => {
529- info ! ( "received TLS-ALPN-01 validation request" ) ;
535+ info ! ( "TLS[acme]: received TLS-ALPN-01 validation request" ) ;
530536 }
531537 Some ( start_handshake) => {
532- let tls_stream = start_handshake. into_stream ( config) . await ?;
538+ debug ! ( "TLS[acme]: start handshake" ) ;
539+ let tls_stream = start_handshake
540+ . into_stream ( config)
541+ . await
542+ . context ( "TLS[acme] handshake" ) ?;
533543 self . serve_connection ( MaybeTlsStreamServer :: Tls ( tls_stream) )
534- . await ?;
544+ . await
545+ . context ( "TLS[acme] serve connection" ) ?;
535546 }
536547 } ,
537548 TlsAcceptor :: Manual ( a) => {
538- let tls_stream = a. accept ( stream) . await ?;
549+ debug ! ( "TLS[manual]: accept" ) ;
550+ let tls_stream = a. accept ( stream) . await . context ( "TLS[manual] accept" ) ?;
539551 self . serve_connection ( MaybeTlsStreamServer :: Tls ( tls_stream) )
540- . await ?;
552+ . await
553+ . context ( "TLS[manual] serve connection" ) ?;
541554 }
542555 }
543556 Ok ( ( ) )
0 commit comments