Skip to main content

notify

Function notify 

Source
pub fn notify(state: &str) -> Result<bool>
Expand description

Send a state message to systemd via $NOTIFY_SOCKET.

Supports both filesystem-path sockets (/run/systemd/notify) and Linux-abstract sockets (the address starts with @ per sd_notify(3); common in container images and namespace-gated hosts). Abstract addresses are routed through libc::sendto with AF_UNIX and a leading NUL byte — UnixDatagram::connect would otherwise resolve the path verbatim and fail with ENOENT, silently breaking the Type=notify readiness handshake.

Returns Ok(false) when $NOTIFY_SOCKET is unset (sozu is not running under systemd notify supervision; the caller can ignore this case). Returns Ok(true) when the datagram was sent. Returns Err(...) for socket / permission failures so the caller can decide whether to log + continue or fail-fast.

Multiple state lines can be packed into a single message by joining them with \n (see STATE_READY / STATE_STOPPING).