Skip to content

Commit

Permalink
feat: wait for upnp service stop
Browse files Browse the repository at this point in the history
  • Loading branch information
storycraft committed Apr 19, 2024
1 parent abb5f8f commit a17a167
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async fn main() -> Result<(), Box<dyn Error>> {

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());
Expand Down Expand Up @@ -109,6 +109,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
select! {
Ok(_) = signal::ctrl_c() => {
log::info!("stopping server...");
let _ = service.await;
}
_ = server(listener, Arc::new(map)) => {}
};
Expand Down

0 comments on commit a17a167

Please sign in to comment.