pub enum SessionEvent {
Ended {
peer: NodeId,
epoch: u64,
},
Established {
peer: NodeId,
epoch: u64,
},
}Expand description
Something happened to the session with a peer.
These are two distinct events and neither substitutes for the other, because a real endpoint learns them separately and can act on only one.
An ending is synchronous and knowable: the operating system closes the handle and the next read or write fails, so a protocol learns at the moment of failure that its last writes may be gone. It cannot act on that, the peer being unreachable.
An establishment is what can be acted on. It happens when the link manages to reconnect — a deployed link keeps trying on its own — so it arrives at a moment the layers above neither choose nor control.
This is a domain concept, not a simulator one: a simulated network and an adapter over TCP or QUIC report the same thing, because it is what a real endpoint learns.
Variants§
Ended
The session with peer has ended. An unknown suffix of what was in flight may be lost.
epoch is the one that ended, not a prediction of the next: at the moment of failure
the next epoch is not a fact, and may never become one.
Established
A session with peer is in force at epoch. The peer can be reached again.
This is the event on which anything must be resent, and the only one on which a resend can succeed.
Implementations§
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SessionEvent
Source§impl Debug for SessionEvent
impl Debug for SessionEvent
impl Eq for SessionEvent
Source§impl Hash for SessionEvent
impl Hash for SessionEvent
Source§impl Ord for SessionEvent
impl Ord for SessionEvent
Source§fn cmp(&self, other: &SessionEvent) -> Ordering
fn cmp(&self, other: &SessionEvent) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SessionEvent
impl PartialEq for SessionEvent
Source§fn eq(&self, other: &SessionEvent) -> bool
fn eq(&self, other: &SessionEvent) -> bool
self and other values to be equal, and is used by ==.