[eval] Set SO_REUSEADDR when binding socket to match Neko, HashLink, and hxcpp#12958
Open
joshtynjala wants to merge 1 commit into
Open
[eval] Set SO_REUSEADDR when binding socket to match Neko, HashLink, and hxcpp#12958joshtynjala wants to merge 1 commit into
joshtynjala wants to merge 1 commit into
Conversation
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.
In Neko, HashLink, and hxcpp, the
SO_REUSEADDRflag is set on a socket when calling the socket'sbind()method on non-Windows targets.https://github.com/HaxeFoundation/neko/blob/v2-4-1/libs/std/socket.c#L559
https://github.com/HaxeFoundation/hashlink/blob/1.15/src/std/socket.c#L284
https://github.com/HaxeFoundation/hxcpp/blob/v4.3.140/src/hx/libs/std/Socket.cpp#L810
The same is not currently true for the Haxe interpreter, which can result in the following error after exiting without closing the socket (such as when using Ctrl+C in a terminal) and then attempting to bind to the same socket again.
This PR brings the eval iterpreter in line with the other targets by setting the
SO_REUSEADDRflag on non-Windows targets too.See #12880 for a code sample that may be used to reproduce the issue.