Skip to main content

serve

Function serve 

Source
pub async fn serve<L: LocalCacheStore + 'static>(
    listener: UnixListener,
    daemon: Arc<NodeCacheDaemon<L>>,
    shutdown: Receiver<bool>,
)
Expand description

Serve requests on listener until shutdown reports true. Each accepted connection handles exactly one request-response pair then closes — this daemon’s protocol is not multiplexed, mirroring its “quick node-local lookup” workload rather than a long-lived session.

Graceful shutdown: tokio::select! races listener.accept() against the shutdown watch, so an in-flight connection being accepted never races a mid-shutdown drop; already-spawned connection tasks are allowed to finish on their own (fire-and-forget Warm background fetches are, by design, best-effort and may be dropped on shutdown — never a correctness requirement).