-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set SO_REUSEADDR for all socket channels to avoid bind errors #82
Conversation
Package.swift
Outdated
@@ -28,7 +28,7 @@ let package = Package( | |||
], | |||
dependencies: [ | |||
// Dependencies declare other packages that this package depends on. | |||
.package(url: "https://github.com/apple/swift-nio.git", from: "1.0.0"), | |||
.package(url: "https://github.com/apple/swift-nio.git", .branch("master")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a temporary change until we have swift-nio 1.9.3
Package.swift
Outdated
@@ -28,7 +28,7 @@ let package = Package( | |||
], | |||
dependencies: [ | |||
// Dependencies declare other packages that this package depends on. | |||
.package(url: "https://github.com/apple/swift-nio.git", from: "1.0.0"), | |||
.package(url: "https://github.com/apple/swift-nio.git", .branch("master")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.9.3 is out :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ianpartridge Thanks! I'm changing it now
e319ba7
to
b7c6c7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Motivation:
To allow reuse socket address and port.
Previously swift-nio was overriding
ChannelOptions.socket
ie. allowing only one socket option to set.Hence as a work-around we were always reusing the port based on the value of
allowPortReuse
With this fix apple/swift-nio#597 , swift-nio allows to set two distinct
ChannelOptions.socket
of one type.And so we can have both the options
ChannelOptions.socket
set for the serverWith this we reuse the port only when necessary.