diff --git a/kinode/src/main.rs b/kinode/src/main.rs index d645e16f..ff73c872 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -736,8 +736,8 @@ async fn serve_register_fe( tx, kill_rx, our_ip, - ws_networking, - tcp_networking, + (ws_networking.0.as_ref(), ws_networking.1), + (tcp_networking.0.as_ref(), tcp_networking.1), http_server_port, disk_keyfile, maybe_rpc) => { @@ -757,6 +757,9 @@ async fn serve_register_fe( let _ = kill_tx.send(true); + drop(ws_networking.0); + drop(tcp_networking.0); + (our, encoded_keyfile, decoded_keyfile) } diff --git a/kinode/src/register.rs b/kinode/src/register.rs index 02288310..03527ef8 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -43,8 +43,8 @@ pub async fn register( tx: RegistrationSender, kill_rx: oneshot::Receiver, ip: String, - ws_networking: (Option, bool), - tcp_networking: (Option, bool), + ws_networking: (Option<&tokio::net::TcpListener>, bool), + tcp_networking: (Option<&tokio::net::TcpListener>, bool), http_port: u16, keyfile: Option>, maybe_rpc: Option, @@ -55,12 +55,12 @@ pub async fn register( let tx = Arc::new(tx); let ws_port = match ws_networking.0 { - Some(ref listener) => listener.local_addr().unwrap().port(), + Some(listener) => listener.local_addr().unwrap().port(), None => 0, }; let ws_flag_used = ws_networking.1; let tcp_port = match tcp_networking.0 { - Some(ref listener) => listener.local_addr().unwrap().port(), + Some(listener) => listener.local_addr().unwrap().port(), None => 0, }; let tcp_flag_used = tcp_networking.1; @@ -258,8 +258,6 @@ 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