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§
- Agent
Config - Settings for an
AgentSession. - Agent
Session - The device agent’s end of the connection.
- Host
Config - Settings for a
HostSession. - Host
Session - The daemon’s end of a device connection.
- Negotiated
- What the handshake settled.
Enums§
- Agent
Event - What happened on an
AgentSession. - Disconnect
Reason - Why a session closed.
- Handshake
Error - Why a handshake failed.
- Host
Event - 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.