Skip to content

Handle unsupported "paused" announces without closing the connection - #98

Closed
jasminsehic wants to merge 3 commits into
Novage:mainfrom
jasminsehic:handle-paused-announce
Closed

jasminsehic wants to merge 3 commits into
Novage:mainfrom
jasminsehic:handle-paused-announce

Conversation

@jasminsehic

@jasminsehic jasminsehic commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

Handle event: "paused" explicitly in FastTracker.processMessage() rather than treating it as an unknown announce event.

The tracker sends an announce failure response with failure reason: "unsupported announce event: paused" and includes info_hash when it is a string. It does not throw, so the WebSocket transport's connection-closing error path is not triggered. Other unsupported announce events continue to throw as before.

Why

The paused announce event has an established history in the BitTorrent ecosystem and is sent by WebTorrent-capable clients.

  • BEP 21 - Extension for partial seeds: Defines event=paused for partial seeds. BEP 21
  • libtorrent WebTorrent/WebSocket implementation: The WebTorrent support commit explicitly maps announce events, including paused, to WebSocket JSON messages.
  • WebTorrent's reference tracker - June 2022: The upstream PR #411 added handling for the paused client event and was merged on 1 June 2022, shipping in v9.19.0. The reference implementation handles the event as an update, treating it as a start if the peer is not already in the swarm.

This change is intentionally limited to the paused event. It does not implement BEP 21 partial-seed tracking or change swarm membership; it returns an explicit failure response without disrupting the connection.

Implementation

  • Handle only event: "paused" in the announce-event fallback.
  • Send the failure through the existing #sendMessage callback.
  • Include the original info_hash only when it is a string.
  • Add a FastTracker unit test that verifies the failure response and then processes a subsequent valid announce using the same tracker instance and connection context.

The PR validation workflow is also updated from Node 20 to Node 24, matching the main GH workflow. The current ESLint 10 configuration rejects the configured TypeScript tsconfig flag under Node 20, preventing the pre-existing PR workflow from reaching build and test steps.

@mrlika

mrlika commented Oct 12, 2026

Copy link
Copy Markdown
Member

Thanks for the report and the detailed references — they were very helpful. We fixed this on main with the reference tracker's semantics instead of a failure reply: BEP 21 partial seeds send event=paused on every announce, so a failure reply would keep them out of the swarm permanently. bittorrent-tracker (PR #411) treats paused as an update (a start for an unknown peer), so paused is now handled as a periodic announce: the peer is added or refreshed, stays incomplete, and its offers are forwarded.

wt-tracker: 5fdad75 · wt-tracker-rust: Novage/wt-tracker-rust@334badd. Closing this in favour of those commits.

@mrlika mrlika closed this Oct 12, 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