Repository navigation
feat(torrent): share with peers while downloading by default, on phones only over Wi-Fi - #534
Merged
Merged
Conversation
…es only over Wi-Fi
- [torrent] upload now defaults to while-downloading. Apps that saved "off" keep it;
ketch server, Docker and the CLI without an upload key now upload while downloading,
and KETCH_TORRENT_UPLOAD / --torrent-upload turn it off without a config file.
- New [torrent] uploadWifiOnly (on): the Android and iOS apps pause uploads off unmetered
networks and resume them after 3 s on one (Settings > BitTorrent > Only on Wi-Fi).
- TorrentDownloadSource gains uploadsPaused / setUploadsPaused: the engine runs as
DISABLED while paused, seeding intents are kept, and kept intents seed again when
uploads resume or the mode switches to seed, without a restart.
- TorrentSnapshot.seeding reports the intent, so the inspector can stop a seed that waits
for Wi-Fi ("Waiting to seed").
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc73dbdff3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ops before completion
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.
What changes for users
[torrent] uploadis nowwhile-downloading(wasoff). Torrents share the pieces they have while they download and stop when they finish.config.toml, so an install that savedoffstays off.ketch server, Docker and the CLI change on upgrade. They never writeconfig.toml, so setups without anuploadkey start uploading while downloading.KETCH_TORRENT_UPLOAD=offor--torrent-upload offturns it off without a config file (flag > variable >config.toml). Docs and the Docker guide say so.[torrent] uploadWifiOnly, on by default; greyed out while uploading is Off). On mobile data or another metered network, uploads pause at once. They resume after the network has been unmetered for 3 s, because every resume rechecks seeded torrents. Phones start paused off Wi-Fi, so launch never uploads on mobile data. Desktop and the CLI ignore the setting.How
library:torrent:TorrentDownloadSource(uploadsPaused)+setUploadsPaused(). Pausing hands the engineDISABLEDand keeps the configured policy. ThesharingResumescounter re-runs the seeding restore walk whenever the effective policy turns to seed, including a live switch to seed. The newSeedingOutcome.UPLOADS_PAUSEDstops that walk. Completions while paused are recorded by the source (takeDeferredSharing) and never inferred fromtaskCompleted.setSeeding(true)while paused saves the intent. The SDK default staysDISABLED.library:torrent-api:TorrentSnapshot.seeding(intent or live;nullfrom older backends).observealso wakes on intent-only changes.app:shared:UploadNetwork.kt(uploadsPaused,followUploadNetwork).InstanceFactory.uploadNetwork/pauseUploads,InstanceManager.followsUploadNetwork. AndroidunmeteredNetworkChanges/isUnmeteredNow(default network,NOT_METERED,TEMPORARILY_NOT_METEREDon API 30+). iOSNWPathMonitor(satisfied, not expensive, not constrained). Settings switch and search entry, strings in all 10 locales.cli:KETCH_TORRENT_UPLOAD,--torrent-upload, startup banner line.Snapshots
Phone, Settings → BitTorrent (
SettingsDeviceSnapshots): before, the Uploading group had the mode and the limit; after, Only on Wi-Fi sits between them (settings-bittorrent-wifi-*, plus*-upload-off-*showing it dimmed). Images to follow.Tests
:library:torrent:jvmTest(1,240),:library:torrent-api,:library:remote,:library:server,:library:mcp,:config:jvmTest,:app:shared:jvmTest(2,333),:cli:test: all pass.checkKotlinAbipasses;UnmeteredNetworkTestpasses on the iOS simulator.restoreSeeding = false;UploadNetworkTeston virtual time;InstanceManagerUploadNetworkTest;SeedingControlTest; config default/migration tests;ServerEnvironmentTest.Known limits