Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Update to go-reuseport 0.2.0 #6

Merged
merged 5 commits into from
Jan 4, 2019
Merged

Update to go-reuseport 0.2.0 #6

merged 5 commits into from
Jan 4, 2019

Conversation

anacrolix
Copy link
Contributor

go-reuseport no longer provides a Dialer that implicitly applies SetLinger(0). This restores expected functionality.

@ghost ghost assigned anacrolix Jan 4, 2019
@ghost ghost added the status/in-progress In progress label Jan 4, 2019
// Dials using reusport and then redials normally if that fails.
func reuseDial(ctx context.Context, laddr *net.TCPAddr, network, raddr string) (net.Conn, error) {
// Dials using reuseport and then redials normally if that fails.
// TODO(anacrolix): This shouldn't fail anymore: Remove fallback.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for when we can't pick a reasonable source port. For example, when:

  1. We're listening on two localhost addresses.
  2. We're dialing a non-localhost address.

In that case, we'll use the multiDialer (we have multiple source ports to choose from) but we'll end up picking none of them.

Really, we could probably just not call reuseDial in this case.

reuseport.go Show resolved Hide resolved
@Stebalien
Copy link
Member

Merging this now to restore functionality. TODO:

Given that most users are still stuck with go get, let's try to merge breaking changes like this all together (that's also why I tend to be really reluctant to break things, even minor things). All hail go.mod and actual version constraints!

@anacrolix anacrolix deleted the reuseport-control branch January 5, 2019 05:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants