Repository navigation
fix(torrent): resume into the chosen folder, find magnet metadata faster and stop dialing ourselves - #538
Merged
Conversation
…ter and stop dialing ourselves - A torrent whose process exited before its first save restarted fresh under a new `name (n)` beside the folder its ownership journal is bound to, failing every retry with "Ownership journal belongs to another task". A source that writes its own files now resumes into the output path its task chose, even without saved segments. - "Download all files now" (and "Add all") on a magnet still looking for its file list added it waiting for a file choice; it now downloads every file once the list arrives. - Magnet lookups ask 16 peers at once, each allowed 8 s to connect, instead of 4 with up to 20 s, which left most of a large swarm unasked; the log reports peers found and asked. - Peers at our own public address (the router's while it maps our port, else the DHT's vote) are left out of tracker and DHT answers and of lookups, which dialed our current and earlier listen ports; IPv4-mapped IPv6 peers are read as IPv4, so none is dialed twice.
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: 09090470bb
ℹ️ 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".
…leaving room for uTP
Contributor
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.
Found while watching a desktop session's log: a torrent that failed forever after a quick quit, a "Download all files now" that paused, and magnet lookups that barely tried their peers.
What changes for users
Sintel (3)besideSintel (2)), and the torrent's ownership journal, bound to the first name, failed every retry. It now resumes into the folder it chose. Tasks already stuck this way stay stuck; remove and add them again.::ffff:a.b.c.d).How
library:core:DownloadCoordinator.resumetreats a self-managed task with an output path and no saved segments as resumable (an empty segment list), instead of falling back to a fresh start, which picks a newname (n).app:shared:IntakeEntry.allFiles, set by both buttons;requestsForsetsawaitFileSelectiononly for a plain Add anyway.library:torrent:METADATA_PARALLEL_PEERS4 → 16; dials keep the standard connect deadline, so a peer only reachable over uTP still gets TCP's 10 s and then uTP. Only one exchange at a time holds the metadata buffer, so memory stays bounded.fetchFromMetadataPeersreports peers asked (onAsked) beside peers found, and skips peers askippredicate rules out when their turn comes, retries included.KotlinTorrentEngine.isOwnAddressdrops peers at our public address (any port) from tracker answers (announceToTrackerwraps everyTrackerTiers), DHT lookups and metadata lookups. The address comes fromTorrentPortMapper(newonExternalAddress: NAT-PMP's reply, asked again on renewal, or UPnPGetExternalIPAddress), else from the DHT's own vote (DhtNode.externalHost).numericHostwrites::ffff:a.b.c.dasa.b.c.d. The DHT already refused mapped node addresses, so only peers change.Tests
:library:core:jvmTestand:library:torrent:jvmTestpass in full; the newresume_withoutSavedSegments_keepsTheChosenOutputPathfails without the fix.:app:shared:jvmTest --tests '*IntakeStateTest*'passes (66), including the newdownloadAllNow_magnetOnSupportingDevice_downloadsEveryFile.TorrentMetadataPeersTest(16 at once, asked counts, a peer ruled out after it failed),PortMappingTest(the external address from NAT-PMP and UPnP),TorrentTrackerTest(a mappedpeers6entry).Known limits