pub enum StreamLiveness {
Disabled,
Probe {
interval: ProbeInterval,
deadline: ProbeDeadline,
},
}transport-http only.Expand description
How a session’s standalone GET (SSE) stream is checked for a dead peer.
With StreamLiveness::Probe, mcpls sends an MCP ping request on the
stream every interval. A client that does not answer it (by sending the
JSON-RPC response in a POST) within deadline has its stream closed and the
resources behind it released. This is portable, needs no socket options,
and also detects a peer that vanished behind a reverse proxy, which TCP
keepalive cannot.
A client that ignores server ping requests is closed and reconnects
every interval + deadline; use StreamLiveness::Disabled for such
clients.
§Examples
use std::assert_matches;
use mcpls_core::StreamLiveness;
assert_matches!(StreamLiveness::default(), StreamLiveness::Probe { .. });Variants§
Disabled
Never probe; a vanished peer is noticed only when the OS gives up on
the connection. A POST or resume stream is still cut once it has been
open for ResponseStreamDeadline; a peer that stopped reading a
response loses its connection after HttpConfig::write_stall_timeout
and its session slot after the idle timeout, which no probe could
free sooner either. Without proof of life an
open GET stream does not keep its session alive: the session expires
after the idle timeout (5 minutes) without inbound requests, even while
the stream receives notifications.
Probe
Probe every interval; close the stream when unanswered for
deadline.
Fields
interval: ProbeIntervalDelay between the end of one probe and the start of the next.
deadline: ProbeDeadlineTime a client has to answer a probe.
Implementations§
Trait Implementations§
Source§impl Clone for StreamLiveness
impl Clone for StreamLiveness
impl Copy for StreamLiveness
Source§impl Debug for StreamLiveness
impl Debug for StreamLiveness
Source§impl Default for StreamLiveness
impl Default for StreamLiveness
impl Eq for StreamLiveness
Source§impl PartialEq for StreamLiveness
impl PartialEq for StreamLiveness
impl StructuralPartialEq for StreamLiveness
Auto Trait Implementations§
impl Freeze for StreamLiveness
impl RefUnwindSafe for StreamLiveness
impl Send for StreamLiveness
impl Sync for StreamLiveness
impl Unpin for StreamLiveness
impl UnsafeUnpin for StreamLiveness
impl UnwindSafe for StreamLiveness
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.