Skip to main content

Module server

Module server 

Source
Expand description

Cross-platform local-socket server: accept connections, dispatch wire requests, write wire responses.

Uses interprocess to abstract the platform IPC primitive: AF_UNIX socket files on Unix, named pipes on Windows. Each connection is a separate Tokio task. Per-primitive handlers live in submodules; this file owns the listener loop, the per-connection reader, and the dispatch table.

Functions§

dispatch
Translate a parsed Request into a wire response (warnings + envelope + body, terminated by \n per the protocol spec — the caller adds the final blank line).
serve
Bind a local socket at path and serve daemon on it. On Unix path is the AF_UNIX socket file; on Windows it’s used to derive a stable namespaced pipe name (see crate::transport::path_to_name). Loops until shutdown resolves.