Connection
struct ConnectionTop-level connection state.
Holds the connection-level state, the per-stream map, and the timer-shape fields the driver uses to schedule the next tick. The connection here only tracks the data-plane state machines.
Uses :class:Dict for the stream map so the driver can look
up by stream id in O(1); RFC 9000 caps stream ids at 2**62-1
so the key space is wide enough that stream-id overflow is a
non-concern.
Implements Copyable, Movable
- Fields
state: Inthandshake_complete: Boolidle_timeout_us: UInt64last_activity_us: UInt64max_data_send: UInt64max_data_recv: UInt64bytes_in_flight: UInt64streams: Dict[UInt64, Stream]ack_pending: Boollargest_received_packet: UInt64largest_acked_by_peer: UInt64close_error_code: UInt64close_reason: List[UInt8]peer_cids: Dict[UInt64, _PeerConnId]: Peer-issued Source CIDs (RFC 9000 §5.1.1) keyed by sequence number, learned from NEW_CONNECTION_ID. The migration path picks a spare entry as the next active Destination CID.active_dcid_seq: UInt64: Sequence number of the peer CID currently used as the active Destination CID.0is the handshake CID (§5.1.1).peer_retire_prior_to: UInt64: Highestretire_prior_tothe peer has sent; every sequence number below it is retired for good.outgoing_path_challenge: List[UInt8]: The 8-byte PATH_CHALLENGE payload we last sent while probing a new path; an inbound PATH_RESPONSE must echo it to validate the path (§8.2). Empty when no probe is outstanding.path_validated: Bool: True once the outstanding path probe was confirmed by a matching PATH_RESPONSE.is_server: Bool: True for the server role (set by :class:QuicConnection). A server treats a received HANDSHAKE_DONE as a PROTOCOL_VIOLATION (RFC 9000 §19.20).adv_max_streams_bidi: UInt64: Peer-initiated bidirectional streams we have allowed (initial_max_streams_bidiplus any MAX_STREAMS raise); a stream id above it is a STREAM_LIMIT_ERROR (RFC 9000 §4.6).adv_max_streams_uni: UInt64: The same for peer-initiated unidirectional streams.check_stream_ids: Bool: Whether :func:check_stream_frame_idruns on received stream frames. Set by the server (:class:QuicConnection) and the client (:class:QuicClientConnection); off for a bare sans-I/O connection, which has no notion of which streams its driver opened.next_local_bidi: UInt64: The next locally initiated bidirectional stream id that has not been opened (client 0, 4, ...; server 1, 5, ...). The client advances it inopen_bidi_stream; the server opens none.next_local_uni: UInt64: The same for unidirectional streams (client 2, 6, ...; server 3, ...).peer_initial_max_stream_data: UInt64: Send limit a peer-initiated stream starts with: the peer'sinitial_max_stream_data_bidi_local(RFC 9000 sec 18.2). The server holds it at 0 until it has read the client's transport parameters, then raises it and every open stream's limit.new_token: List[UInt8]: The latest NEW_TOKEN token the server sent (client side, RFC 9000 sec 8.1.3), for the Initial of a later connection to it.ack_freq_set: Bool: The peer sent ACK_FREQUENCY (draft-ietf-quic-ack-frequency): ACKs follow its threshold and delay instead of going out with every burst of packets.ack_freq_seq: UInt64: The lowest ACK_FREQUENCY sequence number still applied.ack_threshold: UInt64ack_max_delay_us: UInt64ack_immediate: Boolack_unacked: Int: Ack-eliciting packets received since the last ACK was sent.ack_first_us: UInt64max_datagram_recv: UInt64: Themax_datagram_frame_sizewe advertised (RFC 9221 sec 3); 0 when we did not, and then any DATAGRAM frame is a PROTOCOL_VIOLATION, as is one larger than this.