Repository navigation
Conversation
Profiling showed the direct WebRTC path is CPU-bound in pion's SCTP stack (about 30 MiB/s on loopback) while the relay WebSocket alone moves about 120 MiB/s, yet once the direct path opened the relay sat idle. Senders now keep both busy: each path's writer goroutine takes the next data record when it has room, and a perturb-and-observe controller tunes the relay's share of the in-flight budget toward the highest acknowledged rate. Relay records stay held until acknowledged and go out again on the direct path if the relay fails. Receivers already merge both paths by sequence number and drop second copies, so no protocol change is needed. CD_STRIPE=0 restores the previous behavior. Also clear the read deadline waitRelayEvent leaves on the WebSocket (10s on a receiver): the link's relay reader inherited it, so a receive that stayed on the relay for more than ~10s died with "transfer stalled". Local bench, 256 MiB CLI -> CLI: 28.8 -> 54.4 MiB/s (median of 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012g5D2t4GGkGV1pn3Z2EcC4
The OPFS sink now starts each flush without waiting for it, keeping one write in flight so decrypting the next records overlaps disk I/O; close drains it and a failed write surfaces on the next write or close. rechunk yields pieces that are already chunk-sized as-is instead of copying them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012g5D2t4GGkGV1pn3Z2EcC4
A complete short code connects as it is typed, which hides the button, so the bench's click retried until its 600s timeout and never measured the transfer. Start timing before the fill and click only if visible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012g5D2t4GGkGV1pn3Z2EcC4
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
CLI: use the relay and the direct path together (
cmd/cdx/stripe.go)recordLinkand browsercreateRecordMerger) already merge both paths by sequence number and drop second copies. Both shipped in the same commit as the direct path.CD_STRIPE=0restores the old behavior.CLI bug fix: relay transfers longer than ~10 s failed (
link.go)waitRelayEventleaves its read deadline on the WebSocket: 10 s on a receiver, 15 min on a sender.transfer stalled.Web
sink.js: the OPFS sink keeps one write in flight, so decrypting the next records overlaps disk I/O.closedrains the pending write.writeor onclose.zip-bundle.js:rechunkpasses pieces that are already chunk-sized through without copying them.Bench
scripts/bench.mjsclicked#connect-btn, but a complete short code connects as it is typed and hides that button.Test results
Local bench (wrangler dev on loopback, 256 MiB CLI → CLI, 3 runs each):
CD_STRIPE=0)Production relay (
wss://cd.yash0.in, real internet path through Cloudflare). Sender and receiver ran in the same cloud container, but all traffic left the machine. Every transfer was sha256-verified.cdx(main)cdxCD_DIRECT=0)transfer stalledafter ~10 sThe last row confirms the deployed web receiver handles striped records: the hash matches and the sender exits 0. Its speed is limited by headless Chromium.
Other checks
go test -race ./...passes, including 9 new striper unit tests.TestDirectPathConnectsWithTrickledCandidateswas skipped. It also fails onmainin this sandbox, which labels its address "direct internet path".npm test(57 pass),npm run typecheck, andnpm run buildpass.verify:cli-loop: 10/10 transfers exit 0 with exact bytes.Not tested: two physically separate machines. I couldn't start a second cloud machine from this session. Every transfer above crossed the real internet through the production relay, but both ends were in one container. Please do a quick check between two PCs on different networks, for example:
cdx send big.isoon one PC andcdx receive <code>on the other.CD_STRIPE=0.Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_012g5D2t4GGkGV1pn3Z2EcC4
Generated by Claude Code