send_event_shared

Function send_event_shared 

Source
async fn send_event_shared(
    writer: &Arc<Mutex<Box<dyn AsyncWrite + Unpin + Send>>>,
    event: Event,
) -> Result<()>
Expand description

Serialize an Event as one JSON line + \n and write atomically (under the per-connection writer mutex). Returns Err if the connection died mid-write.

CPD-2 — generalized from Arc<Mutex<WriteHalf<NamedPipeServer>>> to crate::host_pipe::SharedWriter so the launcher’s IPC server

  • the host_pipe wrapper share one writer-handle representation. Wire shape is unchanged: a non-host client sees a raw Event JSON line (legacy schema), a host client sees a HostFrame::Event envelope only when the frame goes through HostPipe::send_event. Connection-private error replies in this file still emit raw Event JSON to preserve backwards compat with existing host versions that haven’t adopted the envelope yet — CPD-1 lands the host-side schema migration.