From 80b3aaa0196e876baa063116c39f07de59b0c59f Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 11 Jun 2024 11:55:51 -0600 Subject: [PATCH] fix: don't drop ports til registration is over --- kinode/src/register.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kinode/src/register.rs b/kinode/src/register.rs index a1e96431..02288310 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -55,12 +55,12 @@ pub async fn register( let tx = Arc::new(tx); let ws_port = match ws_networking.0 { - Some(listener) => listener.local_addr().unwrap().port(), + Some(ref listener) => listener.local_addr().unwrap().port(), None => 0, }; let ws_flag_used = ws_networking.1; let tcp_port = match tcp_networking.0 { - Some(listener) => listener.local_addr().unwrap().port(), + Some(ref listener) => listener.local_addr().unwrap().port(), None => 0, }; let tcp_flag_used = tcp_networking.1; @@ -258,6 +258,8 @@ pub async fn register( let _ = open::that(format!("http://localhost:{}/", http_port)); warp::serve(routes) .bind_with_graceful_shutdown(([0, 0, 0, 0], http_port), async { + drop(ws_networking.0); + drop(tcp_networking.0); kill_rx.await.ok(); }) .1