pub enum ConnectionError {
Endpoint(EndpointError),
Codec(CodecError),
Transport(TransportError),
VarInt(VarIntError),
NoControlStream,
UnexpectedEnd,
StreamFinished,
InvalidAddress(String),
TlsConfig(String),
DataStreamState(&'static str),
ControlMessageNarrowing,
}Expand description
Errors from the draft-10 connection layer.
Variants§
Endpoint(EndpointError)
Endpoint state machine error.
Codec(CodecError)
Wire codec error.
Transport(TransportError)
Transport-level error.
VarInt(VarIntError)
Variable-length integer decoding error.
NoControlStream
Control stream was not opened.
UnexpectedEnd
Stream ended before a complete message was read.
StreamFinished
Stream was finished by the peer.
InvalidAddress(String)
Invalid server address string.
TlsConfig(String)
TLS configuration error.
DataStreamState(&'static str)
Data stream used out of order: an object before its header, or an Object ID that does not advance on the last one written.
ControlMessageNarrowing
A control message this build decoded for draft-10 and then could not narrow to draft-10’s own message type.
Unreachable, and that is not the same as harmless. read_control
decodes with this connection’s own draft, so the AnyControlMessage it
hands back can only carry this draft’s variant — but the narrowing arm
is compiled in every configuration anyway, under
#[allow(unreachable_patterns)] rather than a cfg naming the other
drafts, because such a list has to be edited in every draft
module whenever a draft is added, and a copy that omits one leaves the
match non-exhaustive.
Spelled as CodecError::UnknownMessageType(0) it would not stay inert:
every draft’s
codec_session_error_code
answers that variant Some(PROTOCOL_VIOLATION). So the day the
narrowing did fail, this build’s own defect would reach a caller as the
peer sent a control message type this draft does not assign, and the
session must be closed with a Protocol Violation — carrying 0x00 as
the codepoint that proved it. A conformance report reading that
publishes a named, well-evidenced accusation against a relay for
something no relay did.
A variant of its own is what stops that.
draft_specific_cause answers it
LocalRefusal, the facade turns that into ErrorCause::Facade, and
nothing downstream can read a rule out of a cause that says nothing
reached the wire. What is pinned is the consequence rather than the
unreachability: nothing pins the arm’s reachability, which is exactly
why the consequence must not be an accusation.
Trait Implementations§
Source§impl Debug for ConnectionError
impl Debug for ConnectionError
Source§impl Display for ConnectionError
impl Display for ConnectionError
Source§impl Error for ConnectionError
impl Error for ConnectionError
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()
Source§impl From<CodecError> for ConnectionError
impl From<CodecError> for ConnectionError
Source§fn from(source: CodecError) -> Self
fn from(source: CodecError) -> Self
Source§impl From<ConnectionError> for AnyConnectionError
Available on crate feature draft10 only.
impl From<ConnectionError> for AnyConnectionError
draft10 only.Source§fn from(err: ConnectionError) -> Self
fn from(err: ConnectionError) -> Self
Source§impl From<DialError> for ConnectionError
impl From<DialError> for ConnectionError
Source§fn from(e: DialError) -> Self
fn from(e: DialError) -> Self
Maps a dial failure onto the variants this error already has, so a
caller matches InvalidAddress or TlsConfig.
§LocalSocket joins InvalidAddress, and that is the answer being kept
A socket this machine would not open has a variant of its own on
DialError, and it still arrives here.
Not laziness about the churn — InvalidAddress is one of the
variants the facade reads as
ErrorCause::Facade, which
is_local answers true for, and a failed bind is this side’s by
definition. Routing it to Transport would read better in prose and
would publish this machine’s missing IPv6 stack as the relay’s doing.
The phase is not lost, only unread on this path. A caller measuring
which stage of a dial died reads
DialError::phase off the dial
itself; a caller who arrived at this type named a host:port and asked
for a connection, not for a measurement, and a public variant here for
a distinction nothing on this path reads is churn with no reader, which
is why this impl stays flat.