pub enum ConnectionError {
Show 18 variants
Endpoint(EndpointError),
Codec(CodecError),
Transport(TransportError),
VarInt(VarIntError),
NoControlStream,
UnexpectedEnd,
StreamFinished,
InvalidAddress(String),
TlsConfig(String),
DataStreamState(&'static str),
RequestOnControlStream(MessageType),
RequestStreamMessageOnControlStream(MessageType),
PayloadOnStatusDatagram {
object_id: u64,
payload_len: usize,
status: Option<ObjectStatus>,
},
PropertiesOnNonNormalStatus {
object_id: u64,
properties_len: usize,
status: ObjectStatus,
},
NonRequestOnRequestStream(MessageType),
RespondedToOwnRequest(u64),
FinBeforeResponse(u64),
FinBeforePublishDone(u64),
}Expand description
Errors from the 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 (e.g. object before header).
RequestOnControlStream(MessageType)
A message that begins a request stream was handed to
Connection::send_control. Nothing was written.
RequestStreamMessageOnControlStream(MessageType)
A message draft-19 places on a request stream was handed to
Connection::send_control. Nothing was written.
Distinct from ConnectionError::RequestOnControlStream, which is about
a message that would begin a request stream of its own. This one is
about a message that belongs on a request stream already open, and so has
no meaning without one around it.
PayloadOnStatusDatagram
A datagram carrying an Object Status arrived with bytes after its header. Draft-19 Section 11.2.1.1: “An Object MUST have an empty payload unless its Object Status value is registered as permitting a payload in the Object Status registry” Section 11.3.1 says the same thing about the framing: a datagram with the STATUS bit set “is present and there is no Object Payload.”
The codec cannot see this. DatagramHeader::decode stops at the end of
the header and never owns the datagram’s tail, so the only layer that
holds both the status and the bytes after it is this one. Without the
check the application is handed, say, an End-of-Group object carrying
four bytes of payload — a combination the draft forbids outright.
Recoverable: the drafts state the rule as a property of a conforming object, not as one of the “MUST close the session” cases, so the datagram is refused and the session left running.
Fields
status: Option<ObjectStatus>The status the header declared.
Spelled out in full because the glob import of moqtap_codec::types
brings a different ObjectStatus into this module.
PropertiesOnNonNormalStatus
An Object arrived carrying properties on a status that is not Normal.
Draft-19 Section 11.2.1.2: “Any Object with status Normal can have properties (Section 2.5). If an endpoint receives properties on an Object with status that is not Normal, it MUST close the session with a PROTOCOL_VIOLATION.”
The codec decodes such an Object rather than refusing it — the frame is well formed, and a tool that reports non-conforming traffic has to be able to read it. Being an endpoint rather than an observer is what turns it into an error, so it is raised here, on the receive path, and not in the decoder.
Fields
status: ObjectStatusThe Object’s status, resolved through the encoding’s elision rule.
Spelled out in full because the glob import of moqtap_codec::types
brings a different ObjectStatus into this module.
NonRequestOnRequestStream(MessageType)
A bidirectional stream the peer opened began with a message type that does not open a request stream.
Draft-19 Section 3.3: “Bidirectional streams MUST NOT begin with any other message type unless negotiated. If they do, the peer MUST close the Session with a PROTOCOL_VIOLATION.” The session has already been closed on the wire by the time this is returned, and the offending stream reset.
RespondedToOwnRequest(u64)
A respond_* helper was handed a request stream this endpoint opened.
Nothing was written and no state moved.
FinBeforeResponse(u64)
RequestStream::finish was called on a request stream the peer opened
before a response had been written on it. Nothing was written.
Draft-19 Section 3.3.2: “An endpoint MUST NOT send a FIN on a direction of a request stream until it has sent all required messages on that direction for its request type. In particular, an endpoint sending a response to a request MUST send the corresponding response message … before sending a FIN.” The section is new in draft-19; drafts 17 and 18 have no such rule and no such guard.
FinBeforePublishDone(u64)
RequestStream::finish was called on a subscription this endpoint is
the publisher of, before PUBLISH_DONE. Nothing was written.
The second half of the same sentence in draft-19 Section 3.3.2: “the
publisher of an Established subscription MUST send PUBLISH_DONE, before
sending a FIN.” It applies to the accepted SUBSCRIBE a responder
answered with SUBSCRIBE_OK and to the PUBLISH this endpoint sent, which
is why Connection::publish_done and
Connection::publish_done_on are the only routes that clear it.
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()