From bccc251fef98858fae1364208f2dc4e325224183 Mon Sep 17 00:00:00 2001 From: dasha_uwu Date: Thu, 12 Feb 2026 03:57:34 +0500 Subject: [PATCH] remove unix socket on shutdown --- src/router/serve/unix.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/router/serve/unix.rs b/src/router/serve/unix.rs index e4c489f4..45db1bd3 100644 --- a/src/router/serve/unix.rs +++ b/src/router/serve/unix.rs @@ -10,6 +10,7 @@ use std::{ use axum::{Extension, Router, extract::ConnectInfo}; use axum_server::Handle; +use futures::FutureExt; use tokio::task::JoinSet; use tuwunel_core::{Result, Server, info, warn}; @@ -39,7 +40,11 @@ pub(super) async fn serve( .into_make_service(); let acceptor = axum_server::from_unix(unix_listener)? .handle(handle.clone()) - .serve(router); + .serve(router) + .map({ + let path = path.to_owned(); + |_| fs::remove_file(path) + }); join_set.spawn_on(acceptor, server.runtime()); info!("Listening at {path:?}");