Skip to main content

Module session

Module session 

Source
Expand description

The daemon session: one connection, two tasks, one shared state (blueprint §7.3).

  Node ──► outgoing mpsc ──► writer task ──► FramedWriter ──► daemon
                                                                │
  EventStream ◄── EventSource ◄── reader task ◄── FramedReader ◄─┘
                       ▲
                       └── RouteTable (§6.3), extension replies, HLC

Everything a node calls goes into the bounded outgoing channel and returns immediately — a send never waits on a socket. Everything the daemon says is decoded by the reader task and dispatched: data onto the per-input queues, control onto the control lane, route changes into the RouteTable, extension answers to whoever asked.

§Why the outgoing channel is bounded

An unbounded one turns a wedged daemon into unbounded memory growth in every node simultaneously — the failure mode that takes a robot down rather than one process. SessionShared::try_send reports NodeError::Backpressure instead, and the blocking and async senders wait for room.

§Shutdown

SessionShared::close closes the outgoing channel, which ends the writer task, which closes the socket, which ends the reader task, which closes the EventSource and wakes every waiter. One direction, no cross-task signalling, no ordering questions.

Re-exports§

pub use connect::LinkDuplex;
pub use connect::LinkReader;
pub use connect::LinkWriter;
pub use inputs::InputPlaneStats;
pub use inputs::InputRouteTable;
pub use inputs::MAX_CONSECUTIVE_LAGS;
pub use inputs::RECV_SLICE;
pub use routes::RoutePlane;
pub use routes::RouteSlot;
pub use routes::RouteTable;
pub use routes::RouteUpdate;

Modules§

connect
Dialling the daemon (blueprint §4.2, §7.2).
inputs
The slow-start route handshake, consumer side (blueprint §6.2, §6.3).
pump
The two tasks that move frames, and the dispatcher between them.
routes
The slow-start route handshake, node side (blueprint §6.3).

Structs§

SessionShared
The state both the node and its session tasks share.
SessionStats
Counters a node can read off its live session.

Enums§

Outgoing
One thing to write to the daemon.

Constants§

DEFAULT_REPLY_TIMEOUT
How long a reply-carrying request waits by default.
OUTGOING_CAPACITY
How many requests may queue for the writer task before a caller waits.

Type Aliases§

ExtReply
The answer an ExtLoad is waiting for.