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

Add bind_reusablemethod to UdpSocket #21480

Closed
wants to merge 5 commits into from
Closed

Add bind_reusablemethod to UdpSocket #21480

wants to merge 5 commits into from

Conversation

danslapman
Copy link
Contributor

This implements bind_reusable method for UdpSocket, which binds socket with SO_REUSEADDR set to true. Such behaviour is necessary in some cases, such as monitoring multiple multicast streams on the same machine. See also #11758

@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

I made a similar comment on another PR, but I think that this may be best left off for now. We're actively redesigning the I/O system in a set of new RFCs. Currently one does not exist for std::net yet (it was part of the original monster-RFC), but I'll try to remember to ping this once that pops up!

We'll try to remember to handle this case as well, as I'm sure you're not the only one wanting this functionality! For now though I'm going to close this while we consider the new I/O system and we hope to have that RFC up soon!

@kali
Copy link
Contributor

kali commented Feb 14, 2015

The new io is here, with no bind_reusable. Should we rebase/refactor this patch ? It would be a shame to freeze the io api with no reusable bind (it makes it impossible to implement things like SSDP and other multicast based protocol).

@danslapman
Copy link
Contributor Author

Truly, @alexcrichton, I'm forced to support a fork of Rust with the only difference - "bind_reusable" :)

@alexcrichton
Copy link
Member

@kali, @danslapman it is correct that there is currently no method for doing this, but this was explicitly discussed in the RFC. Adding this sort of behavior will likely not be done through a new bind_reusable constructor but rather a more general mechanism of starting with a Socket, settings some options, and then later binding or connecting it into a UdpSocket or TcpStream for example.

These sorts of additions are definitely planned for, but are all backwards compatible extensions to the API. An RFC will be required, however, to add this new API as it was not explicitly designed in rust-lang/rfcs#807

@kali
Copy link
Contributor

kali commented Feb 16, 2015

Ok. Thanks for confirming this is still in the plan, and apologies for missing it in the monster io rfc.

@alexcrichton
Copy link
Member

No worries! Even I often forget what's inside the RFCs...

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.

5 participants