From a3a4786d003903bf846cd1e66448190f3c78aac6 Mon Sep 17 00:00:00 2001 From: Christopher Gubbin <44929740+cgubbin@users.noreply.github.com> Date: Sat, 29 Jan 2022 15:24:04 +0000 Subject: [PATCH] Updated basics/shutdown-server to v4. (#481) --- basics/shutdown-server/Cargo.toml | 6 +++--- basics/shutdown-server/src/main.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/basics/shutdown-server/Cargo.toml b/basics/shutdown-server/Cargo.toml index f0d3d60f..72f1299c 100644 --- a/basics/shutdown-server/Cargo.toml +++ b/basics/shutdown-server/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "Send a request to the server to shut it down" [dependencies] -actix-web = "3" -env_logger = "0.8" +actix-web = "4.0.0-beta.21" +env_logger = "0.9" futures = "0.3" -tokio = { version = "0.2", features = ["signal"] } +tokio = { version = "1.16", features = ["signal"] } diff --git a/basics/shutdown-server/src/main.rs b/basics/shutdown-server/src/main.rs index 6ab6bdc4..c564c6cb 100644 --- a/basics/shutdown-server/src/main.rs +++ b/basics/shutdown-server/src/main.rs @@ -29,7 +29,7 @@ async fn main() -> std::io::Result<()> { let server = HttpServer::new(move || { // give the server a Sender in .data App::new() - .data(tx.clone()) + .app_data(web::Data::new(tx.clone())) .wrap(middleware::Logger::default()) .service(hello) .service(stop) @@ -38,7 +38,7 @@ async fn main() -> std::io::Result<()> { .run(); // clone the Server handle - let srv = server.clone(); + let srv = server.handle(); thread::spawn(move || { // wait for shutdown signal rx.recv().unwrap();