From 6b806158dec2166d8149a414c7a740b724e80bed Mon Sep 17 00:00:00 2001 From: John Howard Date: Wed, 14 Feb 2024 10:52:41 -0800 Subject: [PATCH] serve multiple connections --- src/test_helpers/xds.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/test_helpers/xds.rs b/src/test_helpers/xds.rs index 5cff7bdfa..5ce54b4b4 100644 --- a/src/test_helpers/xds.rs +++ b/src/test_helpers/xds.rs @@ -80,15 +80,17 @@ impl AdsServer { tokio::spawn(async move { while let Some(socket) = tls_stream.next().await { let srv = srv.clone(); - if let Err(err) = http2::Builder::new(TokioExecutor) - .serve_connection( - TokioIo::new(socket), - tower_hyper_http_body_compat::TowerService03HttpServiceAsHyper1HttpService::new(srv) - ) - .await - { - error!("Error serving connection: {:?}", err); - } + tokio::spawn(async move { + if let Err(err) = http2::Builder::new(TokioExecutor) + .serve_connection( + TokioIo::new(socket), + tower_hyper_http_body_compat::TowerService03HttpServiceAsHyper1HttpService::new(srv) + ) + .await + { + error!("Error serving connection: {:?}", err); + } + }); } });