#[non_exhaustive]pub struct RmConfig {
pub negotiation: Negotiation,
pub offered_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 reconnect_attempt: u32,
}Expand description
How a RmSession 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.
offered_versions: Vec<ProtocolVersion>The versions this Resource Manager offers, most preferred first.
The default offers both, because every deployed implementation still negotiates
0.0.2-beta while the schemas are tagged v1.0.0.
ack_timeout: DurationHow long to wait for an acknowledgement before reporting a timeout.
A timeout is an event, not a disconnect, so this value is low-stakes.
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, where handshake messages must not appear.
validate_outbound: boolWhether to validate outbound messages and refuse to send an invalid one.
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 RmConfig
impl RmConfig
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 offering(
self,
versions: impl IntoIterator<Item = ProtocolVersion>,
) -> Self
pub fn offering( self, versions: impl IntoIterator<Item = ProtocolVersion>, ) -> Self
Offer exactly these versions.
Sourcepub fn strict_ordering(self) -> Self
pub fn strict_ordering(self) -> Self
Close the session when a message arrives out of order, instead of reporting it.
Sourcepub fn ack_timeout(self, timeout: Duration) -> Self
pub fn ack_timeout(self, timeout: Duration) -> Self
Wait this long for an acknowledgement.
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.