Skip to main content

Module socket

Module socket 

Source

Functions§

cleanup_socket
Remove socket file if it exists. Best-effort, never panics. Sockets now live in ~/.synaps-cli/run/ (mode 0700), so symlink attacks from other users are not possible. Still refuse symlinks as defense-in-depth.
connect_session_socket
Connect to the session endpoint a registration publishes as socket_path, so callers (synaps send, tests) never hard-code the platform transport.
listen_session_socket
Compatibility listener API. Binding is synchronous and refuses occupied paths. Registry users should use SessionEndpoint for atomic bind + publication.
send_to_session_socket
Deliver one payload to a session endpoint: connect, write, close. The listener reads to EOF, and a named pipe has no half-close (shutdown only flushes), so EOF reaches it only when the handle is dropped. Doing all three here means no caller can hold the pipe open by accident.

Type Aliases§

SessionClient
Client end of a per-session endpoint: a stream on the Unix socket at socket_path, or on Windows the named pipe derived from it.