diff --git a/Cargo.lock b/Cargo.lock index 66b95ebd..860f5344 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,17 +306,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "cookie" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - [[package]] name = "cookie" version = "0.17.0" @@ -328,30 +317,13 @@ dependencies = [ "version_check", ] -[[package]] -name = "cookie_store" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d606d0fba62e13cf04db20536c05cb7f13673c161cb47a47a82b9b9e7d3f1daa" -dependencies = [ - "cookie 0.16.2", - "idna 0.2.3", - "log", - "publicsuffix", - "serde", - "serde_derive", - "serde_json", - "time", - "url", -] - [[package]] name = "cookie_store" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" dependencies = [ - "cookie 0.17.0", + "cookie", "idna 0.3.0", "indexmap 1.9.3", "log", @@ -580,6 +552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -614,6 +587,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -659,9 +633,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.24" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" dependencies = [ "bytes", "fnv", @@ -708,9 +682,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "http" -version = "0.2.11" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -719,12 +693,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", "pin-project-lite", ] @@ -742,13 +728,12 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", @@ -757,49 +742,62 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http", "hyper", + "hyper-util", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] -name = "idna" -version = "0.2.3" +name = "hyper-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -951,12 +949,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "md-5" version = "0.10.6" @@ -1188,6 +1180,26 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1404,23 +1416,24 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +version = "0.12.2" +source = "git+https://github.com/zuisong/reqwest?rev=707d75787e2dc2d632263663721116d485d66c19#707d75787e2dc2d632263663721116d485d66c19" dependencies = [ "base64", "bytes", - "cookie 0.16.2", - "cookie_store 0.16.2", - "encoding_rs", + "cookie", + "cookie_store", + "futures-channel", "futures-core", "futures-util", "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -1432,11 +1445,12 @@ dependencies = [ "pin-project-lite", "rustls", "rustls-native-certs", - "rustls-pemfile", + "rustls-pemfile 1.0.4", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "system-configuration", + "sync_wrapper", "tokio", "tokio-native-tls", "tokio-rustls", @@ -1512,24 +1526,27 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ "log", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 2.1.1", + "rustls-pki-types", "schannel", "security-framework", ] @@ -1543,13 +1560,30 @@ dependencies = [ "base64", ] +[[package]] +name = "rustls-pemfile" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f48172685e6ff52a556baa527774f61fcaa884f59daf3375c62a3f1cd2549dab" +dependencies = [ + "base64", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" + [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] @@ -1583,16 +1617,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -1680,6 +1704,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "socket2" version = "0.5.5" @@ -1702,6 +1732,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "2.0.48" @@ -1713,6 +1749,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "syntect" version = "5.1.0" @@ -1734,27 +1776,6 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tempfile" version = "3.9.0" @@ -1885,11 +1906,12 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ "rustls", + "rustls-pki-types", "tokio", ] @@ -1919,6 +1941,28 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -1931,6 +1975,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] @@ -2139,9 +2184,12 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "winapi" @@ -2326,14 +2374,16 @@ dependencies = [ "chardetng", "clap", "clap_complete", - "cookie_store 0.20.0", + "cookie_store", "digest_auth", "dirs", "encoding_rs", "encoding_rs_io", "flate2", "form_urlencoded", + "http-body-util", "hyper", + "hyper-util", "indicatif", "indoc", "jsonxf", @@ -2371,3 +2421,9 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 6bfc318c..3d6dc78a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,10 +48,14 @@ time = "0.3.16" unicode-width = "0.1.9" url = "2.2.2" +[patch.crates-io.reqwest] +git = "https://github.com/zuisong/reqwest" +rev = "707d75787e2dc2d632263663721116d485d66c19" + [dependencies.reqwest] -version = "0.11.18" +version = "0.12.2" default-features = false -features = ["json", "multipart", "blocking", "socks", "cookies"] +features = ["json", "multipart", "blocking", "socks", "cookies", "http2"] [dependencies.syntect] version = "5.1" @@ -68,9 +72,11 @@ assert_cmd = "2.0.8" form_urlencoded = "1.0.1" indoc = "2.0" predicates = "3.0" -hyper = { version = "0.14", features = ["server"] } +hyper = { version = "1.2", features = ["server"] } tokio = { version = "1", features = ["rt", "sync", "time"] } tempfile = "3.2.0" +hyper-util = { version = "0.1.3", features = ["server"] } +http-body-util = "0.1.1" [features] # Ideally network-interface would be disabled by default on certain platforms diff --git a/tests/cli.rs b/tests/cli.rs index 7b71ffc7..1b33b6b6 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -13,6 +13,7 @@ use std::str::FromStr; use std::time::{Duration, SystemTime, UNIX_EPOCH}; use assert_cmd::cmd::Command; +use http_body_util::BodyExt; use indoc::indoc; use predicates::function::function; use predicates::str::contains; @@ -26,7 +27,7 @@ pub trait RequestExt { impl RequestExt for hyper::Request where - T: hyper::body::HttpBody + Send + 'static, + T: hyper::body::Body + Send + 'static, T::Data: Send, T::Error: std::fmt::Debug, { @@ -37,13 +38,7 @@ where } fn body(self) -> Pin> + Send>> { - let fut = async { - hyper::body::to_bytes(self) - .await - .unwrap() - .as_ref() - .to_owned() - }; + let fut = async { self.collect().await.unwrap().to_bytes().to_vec() }; Box::pin(fut) } diff --git a/tests/server/mod.rs b/tests/server/mod.rs index 88db1d3a..9ca6c604 100644 --- a/tests/server/mod.rs +++ b/tests/server/mod.rs @@ -1,18 +1,26 @@ -// Copied from https://github.com/seanmonstar/reqwest/blob/ab49de875ec2326abf25f52f54b249a28e43b69c/tests/support/server.rs +// Copied from https://raw.githubusercontent.com/seanmonstar/reqwest/v0.12.0/tests/support/server.rs // with some slight tweaks use std::convert::Infallible; use std::future::Future; use std::net; +use std::sync::mpsc as std_mpsc; use std::sync::{Arc, Mutex}; use std::thread; +use std::time::Duration; -use hyper::service::{make_service_fn, service_fn}; -use hyper::{Body, Request, Response}; +use http_body_util::Full; +use hyper::body::Bytes; +use hyper::service::service_fn; +use hyper::{Request, Response}; use tokio::runtime; use tokio::sync::oneshot; +type Body = Full; +type Builder = hyper_util::server::conn::auto::Builder; + pub struct Server { addr: net::SocketAddr, + panic_rx: std_mpsc::Receiver<()>, successful_hits: Arc>, total_hits: Arc>, no_hit_checks: bool, @@ -51,17 +59,23 @@ impl Drop for Server { let _ = tx.send(()); } - if !::std::thread::panicking() && !self.no_hit_checks { + if !std::thread::panicking() && !self.no_hit_checks { let total_hits = *self.total_hits.lock().unwrap(); let successful_hits = *self.successful_hits.lock().unwrap(); let failed_hits = total_hits - successful_hits; assert!(total_hits > 0, "test server exited without being called"); - assert!( - failed_hits == 0, + assert_eq!( + failed_hits, 0, "numbers of panicked or in-progress requests: {}", failed_hits ); } + + if !std::thread::panicking() { + self.panic_rx + .recv_timeout(Duration::from_secs(3)) + .expect("test server should not panic"); + } } } @@ -72,72 +86,88 @@ impl Drop for Server { pub fn http(func: F) -> Server where - F: Fn(Request) -> Fut + Send + Sync + 'static, + F: Fn(Request) -> Fut + Send + Sync + 'static, Fut: Future> + Send + 'static, { http_inner(Arc::new(move |req| Box::new(Box::pin(func(req))))) } -type Serv = dyn Fn(Request) -> Box + Send + Sync; +type Serv = dyn Fn(Request) -> Box + Send + Sync; type ServFut = dyn Future> + Send + Unpin; fn http_inner(func: Arc) -> Server { - //Spawn new runtime in thread to prevent reactor execution context conflict + // Spawn new runtime in thread to prevent reactor execution context conflict thread::spawn(move || { - let successful_hits = Arc::new(Mutex::new(0)); - let total_hits = Arc::new(Mutex::new(0)); let rt = runtime::Builder::new_current_thread() .enable_all() .build() .expect("new rt"); - let srv = { - let successful_hits = successful_hits.clone(); - let total_hits = total_hits.clone(); - #[allow(clippy::async_yields_async)] - rt.block_on(async move { - let make_service = make_service_fn(move |_| { - let func = func.clone(); - let successful_hits = successful_hits.clone(); - let total_hits = total_hits.clone(); - async move { - Ok::<_, Infallible>(service_fn(move |req| { - let fut = func(req); - let successful_hits = successful_hits.clone(); - let total_hits = total_hits.clone(); - async move { - *total_hits.lock().unwrap() += 1; - let res = fut.await; - *successful_hits.lock().unwrap() += 1; - Ok::<_, Infallible>(res) - } - })) - } - }); - // Port 0 is used to obtain a dynamically assigned port. - // See https://networkengineering.stackexchange.com/a/64784 - hyper::Server::bind(&([127, 0, 0, 1], 0).into()).serve(make_service) - }) - }; - - let addr = srv.local_addr(); - let (shutdown_tx, shutdown_rx) = oneshot::channel(); - let srv = srv.with_graceful_shutdown(async move { - let _ = shutdown_rx.await; + let successful_hits = Arc::new(Mutex::new(0)); + let total_hits = Arc::new(Mutex::new(0)); + let listener = rt.block_on(async move { + tokio::net::TcpListener::bind(&std::net::SocketAddr::from(([127, 0, 0, 1], 0))) + .await + .unwrap() }); + let addr = listener.local_addr().unwrap(); - thread::Builder::new() - .name("test-server".into()) - .spawn(move || { - rt.block_on(srv).unwrap(); - }) - .expect("thread spawn"); + let (shutdown_tx, shutdown_rx) = oneshot::channel(); + let (panic_tx, panic_rx) = std_mpsc::channel(); + let thread_name = format!( + "test({})-support-server", + thread::current().name().unwrap_or("") + ); + { + let successful_hits = successful_hits.clone(); + let total_hits = total_hits.clone(); + thread::Builder::new() + .name(thread_name) + .spawn(move || { + let task = rt.spawn(async move { + let builder = Builder::new(hyper_util::rt::TokioExecutor::new()); + loop { + let svc = { + let func = func.clone(); + let successful_hits = successful_hits.clone(); + let total_hits = total_hits.clone(); + + service_fn(move |req| { + let successful_hits = successful_hits.clone(); + let total_hits = total_hits.clone(); + let fut = func(req); + async move { + *total_hits.lock().unwrap() += 1; + let res = fut.await; + *successful_hits.lock().unwrap() += 1; + Ok::<_, Infallible>(res) + } + }) + }; + + let (io, _) = listener.accept().await.unwrap(); + + let builder = builder.clone(); + tokio::spawn(async move { + let _ = builder + .serve_connection(hyper_util::rt::TokioIo::new(io), svc) + .await; + }); + } + }); + let _ = rt.block_on(shutdown_rx); + task.abort(); + let _ = panic_tx.send(()); + }) + .expect("thread spawn"); + } Server { addr, + panic_rx, + shutdown_tx: Some(shutdown_tx), successful_hits, total_hits, no_hit_checks: false, - shutdown_tx: Some(shutdown_tx), } }) .join()