Skip to content
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

Only use socket.set_reuse_port on supported operating systems #1

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

zegevlier
Copy link
Contributor

@zegevlier zegevlier commented Jan 24, 2024

Hey!

In server.rs the socket2::Socket::set_reuse_port function is used. This function, as explained in the documentation is only available under "Unix and neither Solaris nor illumos". This PR ensures that this line is only ran on targets where it is supported. This allows metrics to be used on e.g. Windows. This does change the behaviour between unix and non-unix systems, so if another solutions is prefered please feel free to suggest! To note: According to this stackoverflow post, Windows with only SO_REUSEADDR, set by the line above, behaves close to exactly the same as BSD with both SO_REUSEPORT and SO_REUSEADDR.

foundations/src/telemetry/server.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@inikulin inikulin left a comment

Choose a reason for hiding this comment

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

Thank you!

@inikulin inikulin merged commit 61d607a into cloudflare:main Jan 25, 2024
6 checks passed
@zegevlier zegevlier deleted the fix-windows branch January 25, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants