From a17a1672f9a646573b51f0a4fed600c578adfa67 Mon Sep 17 00:00:00 2001 From: storycraft Date: Fri, 19 Apr 2024 11:58:00 +0900 Subject: [PATCH] feat: wait for upnp service stop --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ae1f55d..a43e0af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,7 +80,7 @@ async fn main() -> Result<(), Box> { let ip = local_ip().unwrap_or(IpAddr::V4(Ipv4Addr::UNSPECIFIED)); - spawn(upnp_service(ip, config.port)); + let service = spawn(upnp_service(ip, config.port)); for arg in args { let key = map.register(arg.clone().into()); @@ -109,6 +109,7 @@ async fn main() -> Result<(), Box> { select! { Ok(_) = signal::ctrl_c() => { log::info!("stopping server..."); + let _ = service.await; } _ = server(listener, Arc::new(map)) => {} };