liminal-server 0.25.4

Standalone server for the liminal messaging bus
Documentation
use super::{ConnectionControl, ConnectionRuntime, recover_lock};

impl ConnectionRuntime {
    /// Takes the shutdown decision ahead of any queued push or ordinary control.
    pub(in crate::server::connection) fn take_force_close(&self, pid: u64) -> bool {
        let mut controls = recover_lock(&self.controls);
        let Some(index) = controls.iter().position(|queued| {
            queued.pid == pid && queued.control == ConnectionControl::ForceClose
        }) else {
            return false;
        };
        controls.remove(index);
        true
    }

    /// The frame admission boundary reads the decision without consuming it.
    pub(in crate::server::connection) fn force_close_pending(&self, pid: u64) -> bool {
        recover_lock(&self.controls)
            .iter()
            .any(|queued| queued.pid == pid && queued.control == ConnectionControl::ForceClose)
    }
}