-
Notifications
You must be signed in to change notification settings - Fork 126
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
SO_REUSEADDR #97
Comments
The code that's in master/develop is exceptionally unstable at the moment as I move toward the v2.0 API. So be warned it's not meant for production applications yet, will likely change, and may have some bugs... and missing features! That said, I appreciate any comments, suggestions, and bug reports as this comes together. I had received complaints that the The idea now, as you probably guessed. is that it doesn't chose a specific reuse strategy, but defaults to the same as the underlying library - which is none. The acceptor's As you discovered, I forgot to add a
I will get that added right away, and look at updating an example or two to show how to use it. |
I ended up just creating the acceptor with no args and calling open on that (with the reuse arg). Seems to work as expected!On Feb 26, 2024, at 9:37 AM, Frank Pagliughi ***@***.***> wrote:
The code that's in master/develop is exceptionally unstable at the moment as I move toward the v2.0 API. So be warned it's not meant for production applications yet, will likely change, and may have some bugs... and missing features!
That said, I appreciate any comments, suggestions, and bug reports as this comes together.
I had received complaints that the acceptor in v1 was opinionated in regard to its choices of reuse, and I always felt a little weird that I kept it in when I released the library publicly, since the original design choice was for a specific machine I was working on long ago.
The idea now, as you probably guessed. is that it doesn't chose a specific reuse strategy, but defaults to the same as the underlying library - which is none. The acceptor's open() and bind() calls now take a reuse parameter which you can use to select SO_REUSEADDR or SO_REUSEPORT, or keep the default as zero/none.
As you discovered, I forgot to add a noexcept version of the constructor which includes this parameter. Sounds like I need to add this:
acceptor(const sock_address& addr, int queSize, int reuse, error_code& ec) noexcept;
I will get that added right away, and look at updating an example or two to show how to use it.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Fix is up in the |
From what I can tell, the default for tcp acceptors is now to not reuse addresses but there is a possibility of passing this as a parameter. I can't quite get this to work, though. The examples, using the constructor with "ec" passed, work fine, but if I try the alternate, with the last argument specified as the reuse argument (1?) I get compiler errors. Is there a working example using this option (or can I set REUSEADDR another way)?
The text was updated successfully, but these errors were encountered: