remove unix socket on shutdown

This commit is contained in:
dasha_uwu
2026-02-12 03:57:34 +05:00
committed by Jason Volk
parent bd5203b406
commit bccc251fef

View File

@@ -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:?}");