Repository navigation
Default the run client to an OS-assigned port, widen the default range - #23
Merged
Merged
Conversation
When no pool port is claimed (range exhausted, or no range configured), the run client kept anacrolix's default ListenPort of 42069 and could collide with whichever torrent already held it. Start from 0 and only override with a claimed pool port. Also widen the default port range to 42000-43000 so concurrent torrents get distinct pool ports instead of all but the first falling back to ephemeral ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
NewDefaultClientConfigsetsListenPort = 42069, andRunonly overrode it when a pool port was claimed. In the ephemeral-fallback (range exhausted) and no-range cases, the background process stayed on 42069 and could fail withlisten tcp4 :42069: bind: address already in useagainst whichever torrent already held it.Runnow starts fromListenPort = 0(OS-assigned) and only sets a claimed pool port on top.42069–42069to42000–43000, so concurrent torrents get distinct pool ports instead of all but the first falling back to ephemeral ones.Not in this PR
The add-flow scratch clients (
internal/engine/preview.go,internal/engine/metadata.go) still use the library default of 42069. Adding a torrent while another is running can still fail with the same bind error until those setListenPort = 0too.Test plan
go build ./...go test ./internal/...🤖 Generated with Claude Code