-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 setter and getter for TCP_QUICKACK on TcpStream for Linux #96324
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (or someone else) soon. Please see the contribution instructions for more information. |
r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs |
This comment has been minimized.
This comment has been minimized.
Since this is linux-specific I think it should be an extension trait, similar to os::linux::fs::MetadataExt, albeit as a sealed trait and under |
Agreed, however I tried that approach but ran into the problem that the Socket in TcpStream is private. How do i solve this without creating 2 methods (get/set) for TcpStream? |
There's the internal trait Edit: sorry, clicked the wrong button |
Ah okay, thank you! Thanks for the tip! Ill update the PR.
On 23 Apr 2022, at 17:52, the8472 ***@***.***> wrote:
There's the internal trait sys_common::AsInner to go from the public to the inner structs.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@the8472 hi, I finally got around to updating the PR, please let me know what I can improve! |
library/std/src/os/linux/net.rs
Outdated
/// .expect("Couldn't connect to the server..."); | ||
/// stream.set_quickack(true).expect("set_quickack call failed"); | ||
/// assert_eq!(stream.quickack().unwrap_or(false), true); | ||
/// ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these tests are no_run
it would be good to have actual tests in a test module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I also just remove the no_run
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how rustdoc tests interact with cfgs and PR CI only runs linux tests, so it were to fail it would likely only fail after a merge.
But if you have some non-linux machine you could try and see what happens there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes it failed already, I found one test for the nodelay
and adapted it for quickack
. Hope this works
library/std/src/sys_common/net.rs
Outdated
pub fn quickack(&self) -> io::Result<bool> { | ||
self.inner.quickack() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sys_common
module isn't supposed to contain code behind platform-specifc cfg
s, instead the linux::net
module should do enough unwrapping steps to get to the os::unix
types directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a to_inner method to expose the Socket
FYI I added |
@Dylan-DPC I know it's been a while and I should have updated sooner, however is it possible to try the roll up again? I added |
i think it is better to get a final review from the reviewer first |
@bors r+ rollup=iffy |
⌛ Testing commit 786e875 with merge 9f32407fb5588105af3dff88fa37a0aa5a7a66ea... |
💥 Test timed out |
@dtolnay I don't understand the error, what happend? |
Not sure. @bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (ee285ea): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Footnotes |
Reference issue #96256
Setting TCP_QUICKACK on TcpStream for Linux