Skip to content

Add Unix.SO_REUSEPORT#9869

Merged
xavierleroy merged 2 commits intoocaml:trunkfrom
liyishuai:SO_REUSEPORT
Sep 2, 2020
Merged

Add Unix.SO_REUSEPORT#9869
xavierleroy merged 2 commits intoocaml:trunkfrom
liyishuai:SO_REUSEPORT

Conversation

@liyishuai
Copy link
Copy Markdown
Contributor

Resolve #3512

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

Thanks for this code, I guess it's time to support SO_REUSEPORT.

I'm afraid the file otherlibs/win32/sockopt.c needs updating, symmetrically with otherlibs/unix/sockopt.c.

@liyishuai
Copy link
Copy Markdown
Contributor Author

liyishuai commented Sep 1, 2020

Why are there fewer #ifndefs in otherlibs/win32unix/sockopt.c than otherlibs/unix/sockopt.c?

@xavierleroy
Copy link
Copy Markdown
Contributor

Why are there fewer #ifndefs in otherlibs/win32unix/sockopt.c than otherlibs/win32unix/sockopt.c?

Probably because some of the socket options are guaranteed to be defined by Winsock2, while we weren't sure that every Unix-like system out there has those options.

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@xavierleroy xavierleroy merged commit 63c7071 into ocaml:trunk Sep 2, 2020
@liyishuai liyishuai deleted the SO_REUSEPORT branch September 4, 2020 19:35
SO_DEBUG
| SO_BROADCAST
| SO_REUSEADDR
| SO_REUSEPORT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know that no one should rely on the order of constructors, but shouldn’t this have been added at the end of the type? (and given that we haven’t frozen 4.12, should we move it)

Given the ease with which the wrong stubs can be loaded on bytecode, it doesn’t seem great to have versions of the C stubs which interpret the same numeric constant differently?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It could be prudent to move the new constructor last. However, many other things can go wrong if the wrong stub library is dynamically loaded, so this could just as well make no difference in safety.

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.

Adding SO_REUSEPORT to Unix lib

3 participants