pub struct ControlSocket { /* private fields */ }Expand description
Control socket listener (Unix domain socket).
Manages the Unix domain socket lifecycle: bind, accept, cleanup.
Implementations§
Source§impl ControlSocket
impl ControlSocket
Sourcepub fn bind(config: &ControlConfig) -> Result<Self, Error>
pub fn bind(config: &ControlConfig) -> Result<Self, Error>
Bind a new control socket.
Creates parent directories if needed, removes stale socket files, and binds the Unix listener.
Sourcepub async fn accept_loop(self, control_tx: Sender<ControlMessage>)
pub async fn accept_loop(self, control_tx: Sender<ControlMessage>)
Run the accept loop, forwarding requests to the main event loop via mpsc.
Each accepted connection is handled in a spawned task:
- Read one line of JSON (the request)
- Send (Request, oneshot::Sender) to the main loop
- Wait for the response via oneshot
- Write the response as one line of JSON
- Close the connection
Sourcepub fn socket_path(&self) -> &Path
pub fn socket_path(&self) -> &Path
Get the socket path.
Trait Implementations§
Source§impl Drop for ControlSocket
impl Drop for ControlSocket
Auto Trait Implementations§
impl !Freeze for ControlSocket
impl RefUnwindSafe for ControlSocket
impl Send for ControlSocket
impl Sync for ControlSocket
impl Unpin for ControlSocket
impl UnsafeUnpin for ControlSocket
impl UnwindSafe for ControlSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more