pub fn spawn(
bind_addr: SocketAddr,
promote: Option<PromotionRequest>,
rotate_requested: Option<Arc<AtomicBool>>,
durability_mode: Option<Arc<AtomicU8>>,
shutdown: Arc<AtomicBool>,
authorized_keys: Arc<AuthorizedKeys>,
) -> Result<(JoinHandle<()>, SocketAddr), Box<dyn Error>>Expand description
Spawn the admin listener on a dedicated thread.
The listener is bound (and set non-blocking) here, before the thread
starts, so a taken or misconfigured admin port fails startup loudly —
bound inside the thread it died with an error! nobody joins on,
leaving PROMOTE/ROTATE/DURABILITY silently dead on a
healthy-looking node. Returns the bound address alongside the
handle (they differ from bind_addr when it carries port 0).
Any of promote / rotate_requested / durability_mode may be
None to disable the corresponding command on this node. The
listener still accepts connections and authenticates them — a
disabled command is rejected at the command-dispatch step, not at
connect time, so operator tooling sees a structured ERR rather than
a TCP RST.