pub enum CloseReason {
ZeroLength,
OverCeiling(usize),
PreambleUnderFloor(usize),
PreambleRejected,
AddressMismatch {
expected: String,
derived: String,
},
}Expand description
Why a reader closed its stream.
Every variant is terminal: a closed reader delivers nothing more, and the host closes the socket. None of them is a peer’s fault the host should report upward; a stream that never proved a peer was never announced, so there is nothing to report lost.
Variants§
ZeroLength
A prefix of zero. No encoding produces an empty message.
OverCeiling(usize)
A prefix above PEER_STREAM_MAX_FRAME_BYTES, refused before the body.
PreambleUnderFloor(usize)
A preamble prefix under PEER_STREAM_PREAMBLE_FLOOR, refused before
the body: a key and most of a signature cannot verify.
PreambleRejected
The first body did not verify as an identity assertion. A well-formed message arriving first lands here too: position decides what a body is, and a message is not a preamble.
AddressMismatch
The preamble verified, but the stream was opened toward a different
address (a peer-list entry, an invite, a discovery record’s addr).
The comparison is exact, never case-folded.
Trait Implementations§
Source§impl Clone for CloseReason
impl Clone for CloseReason
Source§impl Debug for CloseReason
impl Debug for CloseReason
Source§impl Display for CloseReason
impl Display for CloseReason
impl Eq for CloseReason
Source§impl Error for CloseReason
impl Error for CloseReason
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()