Expand description
Per-peer connection liveness tracking for libp2p streams. Per-peer connection liveness tracking for libp2p streams.
LivenessStream wraps any AsyncRead + AsyncWrite value and checks an
Arc<AtomicBool> liveness flag before every poll. When the swarm event
loop clears the flag on ConnectionClosed / OutgoingConnectionError, the
very next read or write on any wrapped substream for that peer returns
Err(io::ErrorKind::ConnectionAborted).
This makes dead streams self-signal to their consumers (the per-peer reader
and writer tasks in hopr-transport) without any changes to the
NetworkStreamControl trait or the protocol layer.
Structsยง
- Liveness
Registry ๐ - Shared registry mapping each peer to its connection-liveness flag.
- Liveness
Stream ๐ - An
AsyncRead + AsyncWritewrapper that errors once its connection-liveness flag is cleared.