Skip to content

Answer the requests a receiver does not serve - #71

Open
gwendalsimon wants to merge 1 commit into
mainfrom
fix/subscriber-refuse-unserved
Open

gwendalsimon wants to merge 1 commit into
mainfrom
fix/subscriber-refuse-unserved

Conversation

@gwendalsimon

@gwendalsimon gwendalsimon commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

A receiving application built on moq5 (the moq_sub_* API) now answers every request a peer sends that it does not serve. Before, these requests were never answered and stayed open until the session ended. SUBSCRIBE and TRACK_STATUS get DOES_NOT_EXIST, and the other five kinds (PUBLISH_NAMESPACE, SUBSCRIBE_NAMESPACE, SUBSCRIBE_TRACKS, PUBLISH, and FETCH) get NOT_SUPPORTED, as the publisher API already does. An answer the session cannot send yet is sent on a later tick.

moq-relay announces its namespaces to its peers, and our receiver never answered (openmoq/moq2ts#70).

The checks repeat the publisher API's. Both could share one helper in a follow-up, if you prefer.

I tested it in November 2026 on drafts 18 and 22, including answers held while the session was busy. The full test suite passes.


This change is Reviewable

The subscriber facade dropped every request a peer opened: the session
raised it and waited for an answer that never came, until the session
ended. A relay that announces its namespaces with PUBLISH_NAMESPACE to
each peer was left without the REQUEST_OK or REQUEST_ERROR that draft
18 section 6.2 (section 4.1 in drafts 22 and 23) requires.

* moq_sub_tick now refuses the seven request kinds a subscriber does not
  serve, as the publisher facade's pub_refuse_unserved does:
  DOES_NOT_EXIST for SUBSCRIBE and TRACK_STATUS, NOT_SUPPORTED for
  PUBLISH_NAMESPACE, SUBSCRIBE_NAMESPACE, SUBSCRIBE_TRACKS, PUBLISH and
  FETCH (which the publisher serves).
* A refusal the session cannot take yet is held, in arrival order, and
  sent on a later tick. The queue holds one entry per request the
  session can have open, sized at moq_sub_create.
* The pending checks mirror pub_answer_pending. Sharing them between the
  two facades is left to a follow-up.
* Tests: on drafts 18 and 22, one request of each kind gets exactly one
  refusal with the expected code; with a session limited to four
  actions, refusals are held after the first tick and sent on the next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant