This reference describes unreleased code on main; no release documents it yet.

rlmesh::ext::remove_stale_socket

functionPreviewuse rlmesh::ext::remove_stale_socket;[source]

Remove a leftover Unix-domain socket file before binding.

fn remove_stale_socket(path: &std::path::Path) -> Result<()>

bind(2) returns EADDRINUSE whenever the socket path already exists on disk, regardless of whether anything is listening, so a socket left by a crashed server must be unlinked before we rebind. We probe first to avoid stealing the address from a live server: a successful connect means the socket is live and we refuse to bind, and only a ConnectionRefused probe is treated as stale and unlinked. Any other connect failure (e.g. permission denied) cannot prove the socket is dead, so we report it rather than risk unlinking a socket still in use. Non-socket files are left for bind to reject.