Skip to main content

ensure_running

Function ensure_running 

Source
pub fn ensure_running(opts: &DaemonOpts) -> Result<Ensured, EnsureError>
Expand description

Attach-path entry: a live daemon or a freshly spawned one (jcode model — first client spawns via setsid + ready-fd; the daemon holds the flock). The spawn lock (<stem>.spawn.lock next to the flock) serialises concurrent first-clients: the loser blocks on it, then re-probes the flock and finds the winner’s daemon. Never touches the socket on ECONNREFUSED alone — reap_stale + the flock decide.