Skip to main content

Module malformed_tracks

Module malformed_tracks 

Source
Expand description

What a Malformed Track is, for the drafts whose answer to one is a control message.

Drafts 12 and 13 Section 2.5 list the conditions that make a track malformed and give all of them one answer: “When a subscriber detects a Malformed Track, it MUST UNSUBSCRIBE from the Track and SHOULD deliver an error to the application.” Drafts 14, 15 and 16 widen the same sentence to fetches — “it MUST UNSUBSCRIBE any subscription and FETCH_CANCEL any fetch for that Track from that publisher” — which is a second message and the same record. Drafts 17 through 20 replace both with a cancellation of the request’s own stream — a reset rather than a message — and the record is compiled there too, because what it holds is which track was given up and what for, which is the same question whichever shape the answer takes. It is the conditions that vary by draft, not the record of them; the answer lives on each draft’s connection. What a Malformed Track is in this crate, and what detecting one costs.

Draft-12 Section 2.5 opens the definition: “There are multiple ways a publisher can transmit a Track that does not conform to MoQT constraints. Such a Track is considered malformed. Some example conditions that constitute a malformed track when detected by a receiver include:” — and then eleven bullets, closing with “The above list of conditions is not considered exhaustive.”

The list is examples. What is not an example is the answer, which the same section states once for all of them: “When a subscriber detects a Malformed Track, it MUST UNSUBSCRIBE from the Track and SHOULD deliver an error to the application.” That sentence is the whole of what this module exists for. A condition is detected somewhere in the data plane; the track it names is withdrawn; the caller is told which condition it was.

§A track is withdrawn, and the session is not

Nothing here ends a session. The answer is an UNSUBSCRIBE and an error handed up, and the connection stays exactly where it was — which is why this record and the close table are separate things, and why no condition recorded here reaches crate::draft12::endpoint::EndpointError’s session error codes. A malformed track costs one track.

§The answer is given once, and this record is not what makes it once

A publisher that mixes one track’s framing will usually go on mixing it, and the draft asks for an UNSUBSCRIBE rather than one per offending object. What keeps it to one is the subscription itself: the first withdrawal ends every request the track was arriving through, and a request that has ended has no second UNSUBSCRIBE in it.

So this record does not gate the withdrawal, and the difference matters in one case. An application that subscribes to the same track again is opening a request that has never been withdrawn from, and a publisher that mixes its framing again has broken the sentence again. A record that refused the second withdrawal because it recognised the track would leave that subscription running over traffic the draft says to give up on — remembering a track and refusing to act on it are not the same thing.

§Why the key is the track and not the alias

The same reason crate::forwarding_preference gives, and it bites harder here. An alias is free again the moment its subscription ends and may then name a different track — so a withdrawal recorded against the alias would make the next track’s first malformation look like one already answered, and that track would never be withdrawn at all. The alias is resolved through the endpoint’s binding table before anything is written down.

§What “subscriber” excludes

The sentence names a subscriber, so only the paths on which this endpoint receives a track owe the withdrawal. The two writing paths detect the same condition — an endpoint is the Original Publisher there and the rule that binds it is a rule about publishing — and they answer it by refusing to write, which withdraws nothing because there is nothing to withdraw.

The section’s other sentence is a relay’s: “If a relay detects a Malformed Track, it MUST immediately terminate downstream subscriptions with SUBSCRIBE_DONE with Status Code Malformed Track.” This crate is a client. It has no downstream subscriptions to terminate, so that half is not unimplemented here so much as inapplicable; a relay built on top of this has the condition reported to it and its own downstream to answer for.

Structs§

MalformedTracks
The tracks this endpoint has withdrawn from for malformation.
WithdrawnTrack 🔒
One track that has been found malformed, and what found it.

Enums§

MalformedTrackCondition
Which condition of the list made a track malformed.