Skip to content

Commit

Permalink
pass cancellation token future to servers
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Sep 27, 2024
1 parent e135a8a commit 4ae6251
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions swapd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);
let res = Server::builder()
.add_service(swapper_server)
.serve_with_shutdown(args.address, async {
server_token.cancelled().await;
info!("swapper server shutting down");
})
.serve_with_shutdown(args.address, server_token.cancelled())
.await;
match res {
Ok(_) => info!("swapper server exited"),
Expand Down Expand Up @@ -376,10 +373,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);
let res = Server::builder()
.add_service(internal_server)
.serve_with_shutdown(args.internal_address, async {
internal_server_token.cancelled().await;
info!("internal server shutting down");
})
.serve_with_shutdown(args.internal_address, internal_server_token.cancelled())
.await;
match res {
Ok(_) => info!("internal server exited"),
Expand Down

0 comments on commit 4ae6251

Please sign in to comment.