shim: trackers/web-seeds + session ops + ABI-skew gate (ABI v6→v7)#20
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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*trackersbtTrackers{url, tier, verified, source}recordsadd_trackerbtAddTrackerurl_seeds/add_url_seed/remove_url_seedbtWebSeeds/btAddWebSeed/btRemoveWebSeedFive append-only record fields (
F_TRACKER_*130–133,F_URL_SEED134). Listers reuse the peer-list framing + counted-loop LCB parse (no string-splitting, which the.lcbdoesn't do).Batch 4 — session operations (ABI v6 → v7)
btx_*bt*session_pause/session_resume/session_is_pausedbtSessionPause/btSessionResume/btSessionIsPausedlisten_portbtListenPortfind_torrentbtFindTorrentdht_announcebtDhtAnnounceNo schema change (plain-int returns).
Gate hardening
check-record-registry.pynow also assertsBTX_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
-Wall -Wextra.check-livecodescript7/7;check-record-registry101 in sync (incl. the new ABI cross-check); golden OK; ABI 7↔7.Remaining roadmap
get_peers(with its reply alert) is a natural follow-on too.🤖 Generated with Claude Code
https://claude.ai/code/session_01371AXB4CUUke7enHHS8okc