Skip to main content

Module session

Module session 

Source
Expand description

Connection state machines for both ends of the device link, without I/O.

A HostSession runs in the daemon and an AgentSession in a device agent. The caller feeds bytes read from the socket into receive, writes whatever poll_transmit returns, calls handle_timeout at poll_timeout, and reads what happened from poll_event. Every method that depends on time takes now; the sessions never read the clock themselves.

The agent speaks first: its hello carries the versions it speaks, its capabilities and its maximum frame size. The host answers with a welcome naming the highest version both speak and the smaller maximum frame size, or with the reason it refuses the connection before closing it.

Structs§

AgentConfig
Settings for an AgentSession.
AgentSession
The device agent’s end of the connection.
HostConfig
Settings for a HostSession.
HostSession
The daemon’s end of a device connection.
Negotiated
What the handshake settled.

Enums§

AgentEvent
What happened on an AgentSession.
DisconnectReason
Why a session closed.
HandshakeError
Why a handshake failed.
HostEvent
What happened on a HostSession.
Responded
What became of an answer passed to AgentSession::respond.

Constants§

DEADLINE_GRACE
How long past a request’s deadline the host waits for the agent’s own deadline error before reporting one itself.
PEER_TIMEOUT
How long a peer may stay silent before it is declared dead. With pings every second, three unanswered ones; the spec’s bound for reporting a killed agent is five seconds.
PING_INTERVAL
How long a peer may stay silent before a ping goes out.
RESYNC_BACKOFF
How long the host waits before it sends a failed automatic resync again; the wait doubles with every failure in a row, up to RESYNC_BACKOFF_MAX.
RESYNC_BACKOFF_MAX
The longest wait between two tries of an automatic resync.

Functions§

select_version
The highest version in both lists, whatever their order.