Skip to main content

bind_supervisor_socket

Function bind_supervisor_socket 

Source
pub async fn bind_supervisor_socket(
    home: &AgentsHome,
) -> Result<UnixListener, DaemonError>
Expand description

Bind the supervisor socket, resolving the lazy-start race and stale sockets.

  • If a live daemon answers a connect to the existing socket, we are the race loser: return DaemonError::AlreadyRunning so the caller exits cleanly.
  • If the socket file exists but nothing answers (stale, from a crash), remove and bind.
  • Enforce dir 0700 / socket 0600 regardless of umask, fstat-verifying after (finding #6 Critical).