Skip to main content

clear_stale_unix_socket

Function clear_stale_unix_socket 

Source
pub fn clear_stale_unix_socket(socket_path: &Path) -> Result<bool>
Expand description

Remove a Unix domain socket path only when nothing is accepting connections.

Prefer bind-first + retry in the daemon server over calling this from a parent before spawn: connect→unlink still has a TOCTOU window if another process binds between those steps.

Returns Ok(true) if a stale socket was removed, Ok(false) if the path was absent or still live (left untouched).