Skip to content

shim: trackers/web-seeds + session ops + ABI-skew gate (ABI v6→v7)#20

Merged
SethMorrowSoftware merged 2 commits into
mainfrom
claude/relaxed-cerf-816pyn
Jun 27, 2026
Merged

shim: trackers/web-seeds + session ops + ABI-skew gate (ABI v6→v7)#20
SethMorrowSoftware merged 2 commits into
mainfrom
claude/relaxed-cerf-816pyn

Conversation

@SethMorrowSoftware

@SethMorrowSoftware SethMorrowSoftware commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Two batches of surfacing more of libtorrent (this PR grew a second batch before the first merged — both are independent, append-only ABI bumps).

Batch 3 — trackers & web seeds (ABI v5 → v6)

btx_* bt* what
trackers btTrackers announce list as {url, tier, verified, source} records
add_tracker btAddTracker add an announce URL at a tier (dups ignored)
url_seeds / add_url_seed / remove_url_seed btWebSeeds / btAddWebSeed / btRemoveWebSeed list & manage HTTP/URL seeds (BEP 19)

Five append-only record fields (F_TRACKER_* 130–133, F_URL_SEED 134). Listers reuse the peer-list framing + counted-loop LCB parse (no string-splitting, which the .lcb doesn't do).

Batch 4 — session operations (ABI v6 → v7)

btx_* bt* what
session_pause / session_resume / session_is_paused btSessionPause / btSessionResume / btSessionIsPaused pause/resume every torrent at once
listen_port btListenPort the TCP port we actually bound
find_torrent btFindTorrent recover our handle id from a 40-hex info-hash
dht_announce btDhtAnnounce classic BEP 5 DHT peer announce (vs BEP 44 KV)

No schema change (plain-int returns).

Gate hardening

check-record-registry.py now also asserts BTX_ABI_VERSION (btx_abi.h) == kABIVersion (torrent.lcb). A forgotten bump was previously only caught at runtime by _checkABI(); now it fails the static gate (verified: it flags a forced 6-vs-7 skew). This caught a real skew during Batch 4.

Cumulative

39 → 69 public handlers across v4–v7 this run (flags/caps/queue/storage → file table/availability → trackers/seeds → session ops).

Verification

  • C++: built + run under gcc ASan/UBSan against real libtorrent — 507 checks, 0 failures, clean -Wall -Wextra.
  • Static gates green: check-livecodescript 7/7; check-record-registry 101 in sync (incl. the new ABI cross-check); golden OK; ABI 7↔7.
  • README + api-reference updated. CI rebuilds the committed binaries on merge.

Remaining roadmap

  1. IP filter (blocklists) + extended add (flags/priorities/trackers at add time). DHT get_peers (with its reply alert) is a natural follow-on too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01371AXB4CUUke7enHHS8okc

claude added 2 commits June 27, 2026 03:46
Batch 3 of surfacing more of libtorrent: inspect and edit a torrent's announce
list and its HTTP (URL / web) seeds.

New btx_* ABI (v5 -> v6, append-only):
- btx_trackers - the announce list as a count-prefixed KV-record list:
  url, tier, verified, source (peer-list framing).
- btx_add_tracker - add an announce URL at a given tier (dups ignored).
- btx_add_url_seed / btx_remove_url_seed - manage HTTP/URL seeds (BEP 19).
- btx_url_seeds - the web-seed list (one single-field record per seed).

Record schema: five append-only fields - F_TRACKER_URL/TIER/VERIFIED/SOURCE
(130..133) + F_URL_SEED (134) - mirrored as kField* and keys url/tier/verified/
source/urlSeed in _fieldKey. LCB: kABIVersion -> 6; five foreign decls; btTrackers
(List of Arrays) / btAddTracker / btAddWebSeed / btRemoveWebSeed / btWebSeeds
(List of URL Strings). 58 -> 63 public handlers.

Built + run under gcc ASan/UBSan against real libtorrent: 465 checks, 0
failures, clean -Wall -Wextra. Static gates green (check-livecodescript 7/7;
record-registry 100 in sync; golden OK; ABI 6<->6). README + api-reference
(entries + tracker key table) updated. CI rebuilds the binaries on merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01371AXB4CUUke7enHHS8okc
Batch 4 of surfacing more of libtorrent: whole-session control and lookups.

New btx_* ABI (v6 -> v7, append-only):
- btx_session_pause / btx_session_resume / btx_session_is_paused - pause or
  resume EVERY torrent at once (distinct from per-torrent pause/resume).
- btx_listen_port - the TCP port we actually ended up listening on.
- btx_find_torrent - recover OUR torrent handle id from a 40-hex info-hash.
- btx_dht_announce - classic BEP5 DHT peer announce (vs the BEP44 KV calls).

No record-schema change (all plain-int returns). LCB: kABIVersion -> 7; six
foreign decls + bt* wrappers (btSessionPause/Resume, btSessionIsPaused ->
Boolean, btListenPort, btFindTorrent, btDhtAnnounce). 63 -> 69 public handlers.

Also hardens the gate: check-record-registry.py now asserts BTX_ABI_VERSION
(btx_abi.h) == kABIVersion (torrent.lcb). A forgotten bump was previously only
caught at runtime by _checkABI(); now it fails the static gate (verified: it
flags a forced 6-vs-7 skew).

Built + run under gcc ASan/UBSan against real libtorrent: 507 checks, 0
failures, clean -Wall -Wextra. Static gates green (check-livecodescript 7/7;
record-registry 101 in sync incl. the ABI cross-check; golden OK; ABI 7<->7).
README + api-reference updated. CI rebuilds the binaries on merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01371AXB4CUUke7enHHS8okc
@SethMorrowSoftware SethMorrowSoftware changed the title shim: tracker + web-seed editing & listing (ABI v6) shim: trackers/web-seeds + session ops + ABI-skew gate (ABI v6→v7) Jun 27, 2026
@SethMorrowSoftware SethMorrowSoftware marked this pull request as ready for review June 27, 2026 03:57
@SethMorrowSoftware SethMorrowSoftware merged commit 2800c81 into main Jun 27, 2026
5 of 7 checks passed
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