Skip to content

net: accept_one, so an open stream cannot hold up /v1/status - #8

Merged
Ttimmahlax merged 1 commit into
mainfrom
stream-off-the-accept-loop
Oct 18, 2026
Merged

Ttimmahlax merged 1 commit into
mainfrom
stream-off-the-accept-loop

Conversation

@Ttimmahlax

Copy link
Copy Markdown
Contributor

MjpegHttpServer::serve_one answered and streamed on one thread, so while a viewer had the page open, every other request waited. A hub's /v1/status poll timed out until the tab closed (found on a XIAO: 0 bytes for 15 s, three times, then 200 in 0.13 s once the tab closed), and the listen backlog reset /.

  • accept_one(&mut stats) -> Accepted: answers everything except an admitted /stream (status, page, refusals), and returns that stream as Accepted::Stream(StreamConn).
  • StreamConn::run(source, scratch, stats): plays it on whatever thread the caller chooses.
  • serve_one is accept_one with the stream run in place, so its behaviour is unchanged for existing callers.

Test: the_status_answers_while_a_stream_is_open holds a live stream and gets /v1/status (200) and the page refusal (403) back within 2 s.

🤖 Generated with Claude Code

…status

serve_one answered and streamed on one thread, so a viewer with the page
open held up every other request: /v1/status timed out until the tab
closed, and the backlog reset the page. accept_one answers everything but
an admitted /stream and returns that as a StreamConn to run on any
thread; serve_one is accept_one with the stream run in place. A test
holds a live stream and gets the status and the page's 403 at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ttimmahlax
Ttimmahlax merged commit b21c597 into main Oct 18, 2026
9 checks passed
@Ttimmahlax
Ttimmahlax deleted the stream-off-the-accept-loop branch October 18, 2026 17:15
@Ttimmahlax Ttimmahlax mentioned this pull request Oct 18, 2026
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.

2 participants