#[non_exhaustive]pub struct CemConfig {
pub negotiation: Negotiation,
pub supported_versions: Vec<ProtocolVersion>,
pub ack_timeout: Duration,
pub out_of_order: OutOfOrderPolicy,
pub skew_tolerance: Duration,
pub max_message_bytes: usize,
pub strictness: Strictness,
pub s2_connect: bool,
pub validate_outbound: bool,
pub enforce_transitions: bool,
pub reconnect_attempt: u32,
}Expand description
How a CemSession behaves.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.negotiation: NegotiationHow the protocol version is agreed.
supported_versions: Vec<ProtocolVersion>The versions this manager can speak, most preferred first.
ack_timeout: DurationHow long to wait for an acknowledgement.
out_of_order: OutOfOrderPolicyWhat to do about a message that is not allowed in the current state.
skew_tolerance: DurationHow far a peer’s clock may differ before it is worth reporting.
max_message_bytes: usizeThe largest inbound message that will be parsed.
strictness: StrictnessWhether to prune unknown properties rather than refuse the message.
s2_connect: boolWhether the session runs under S2 Connect.
validate_outbound: boolWhether to validate outbound messages and refuse to send an invalid one.
enforce_transitions: boolWhether to refuse an instruction whose transition is blocked by a timer.
Off by default: the S2 documentation, Operation modes says a Resource Manager may change mode without the CEM asking and even without a described transition, so the manager’s picture of the timers is always slightly stale. Refusing to send on a stale picture is worse than sending and being told no.
reconnect_attempt: u32How many reconnection attempts have already failed.
A session is one connection, so it cannot count these itself. Carry the number
across: the reconnect_after on a Closed event is
Backoff::ceiling for this attempt, and a
session that always starts at zero always recommends two seconds — a back-off that
does not back off.
Implementations§
Source§impl CemConfig
impl CemConfig
Sourcepub fn without_outbound_validation(self) -> Self
pub fn without_outbound_validation(self) -> Self
Stop checking outbound messages before they go.
On by default, because learning at the call site beats earning an
INVALID_CONTENT from a peer. Turn it off for a bridge that must forward exactly
what it was handed, or for a test that needs a peer’s refusal rather than its own.
Sourcepub fn pre_negotiated(self, profile: WireProfile) -> Self
pub fn pre_negotiated(self, profile: WireProfile) -> Self
Use a version that was already agreed, as S2 Connect does.
Sourcepub fn supporting(
self,
versions: impl IntoIterator<Item = ProtocolVersion>,
) -> Self
pub fn supporting( self, versions: impl IntoIterator<Item = ProtocolVersion>, ) -> Self
Support exactly these versions.
Sourcepub const fn after_failed_attempts(self, attempts: u32) -> Self
pub const fn after_failed_attempts(self, attempts: u32) -> Self
Start this session knowing that attempts reconnections have already failed.
What makes the reconnect_after on a Closed event grow. The application owns
the reconnection loop (D36), so it also owns the counter: reset it to zero after a
session that reached Connected, and increment it after one that did not.