std::net: adding tcp_syncnt feature for Linux/Android.#123111
std::net: adding tcp_syncnt feature for Linux/Android.#123111devnexen wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use |
| /// The maximum valid value is 255. | ||
| /// | ||
| /// See [`man 7 tcp`](https://man7.org/linux/man-pages/man7/tcp.7.html) | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ```no_run | ||
| /// #![feature(tcp_syncnt)] | ||
| /// use std::net::TcpStream; | ||
| /// use std::os::linux::net::TcpStreamExt; | ||
| /// | ||
| /// let stream = TcpStream::connect("127.0.0.1:8080") | ||
| /// .expect("Couldn't connect to the server..."); | ||
| /// stream.set_syncnt(3).expect("set_setcnt call failed"); | ||
| #[unstable(feature = "tcp_syncnt", issue = "123112")] | ||
| fn set_syncnt(&self, count: u32) -> io::Result<()>; |
There was a problem hiding this comment.
Just out of curiosity - could the count parameter just be a u8 since the docs state a maximum valid value of 255 (or is it expected that this maximum might rise in the future)?
There was a problem hiding this comment.
it definitively can be u8.
to control the number of client's attempts to establish a connection.
|
The implementation looks fine but adding APIs should probably have some libs-api oversight. So choosing a libs-api member at random... r? joshtriplett |
By the time you have a TcpStream, you already have a connection established, so this may not be effective. We don't have a mechanism for options on unbound sockets. We should, but we don't. (Developing that is a much larger-scale problem.) |
|
@rustbot autho |
|
Oh I forgot this one. Well I guess this is the same issue as here. |
to control the number of client's attempts to establish a connection.