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

TcpStream::close_read has platform-dependent semantics #19428

Closed
jbapple opened this issue Nov 30, 2014 · 2 comments
Closed

TcpStream::close_read has platform-dependent semantics #19428

jbapple opened this issue Nov 30, 2014 · 2 comments

Comments

@jbapple
Copy link

jbapple commented Nov 30, 2014

Under the hood, TcpStream::close_read calls libc::shutdown(self.fd(), libc::SHUT_RD). According to http://stackoverflow.com/questions/14740852/linux-socket-close-vs-shutdown/14743440#14743440 ,

Unix will ACK it and throw it away; Linux will ACK it and buffer it, which will eventually stall the sender; Windows will issue an RST, which the sender sees as 'connection reset by peer'.

Should there be a note in the comment on close_read that the behavior is platform-dependent?

@steveklabnik
Copy link
Member

/cc rust-lang/rfcs#807 and @alexcrichton

@alexcrichton
Copy link
Member

Now that the function is named shutdown and will be clearly documented as calling the shutdown function (which is available on all platforms) I believe that we're fine in this respect. There's no way for us to provide a 100% cross-platform semantics for every piece of behavior (including what's quoted here) but instead provide what the underlying OS provides.

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

No branches or pull requests

4 participants