From d324eab377d44c1b15c30562e9751421f13a9659 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 23 Jan 2023 18:15:03 +0100 Subject: [PATCH] node: Remove control socket at the end --- radicle-node/src/control.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/radicle-node/src/control.rs b/radicle-node/src/control.rs index d6c85115..bdc4d773 100644 --- a/radicle-node/src/control.rs +++ b/radicle-node/src/control.rs @@ -27,8 +27,6 @@ pub fn listen, H: Handle>( path: P, mut handle: H, ) -> Result<(), Error> { - // Remove the socket file on startup before rebinding. - fs::remove_file(&path).ok(); fs::create_dir_all( path.as_ref() .parent() @@ -39,7 +37,7 @@ pub fn listen, H: Handle>( log::info!("Binding control socket {}..", path.as_ref().display()); // TODO: Move socket binding to main thread. - let listener = UnixListener::bind(path).map_err(Error::Bind)?; + let listener = UnixListener::bind(&path).map_err(Error::Bind)?; for incoming in listener.incoming() { match incoming { Ok(mut stream) => { @@ -65,6 +63,7 @@ pub fn listen, H: Handle>( } } log::debug!("Exiting control loop.."); + fs::remove_file(&path).ok(); Ok(()) }