Skip to content

Add setter and getter for TCP_QUICKACK on TcpStream for Linux #96324

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 28, 2022

Conversation

berendjan
Copy link

@berendjan berendjan commented Apr 22, 2022

Reference issue #96256

Setting TCP_QUICKACK on TcpStream for Linux

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 22, 2022
@rust-highfive
Copy link
Contributor

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs to request review from a libs-api team reviewer. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Contributor

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 22, 2022
@berendjan
Copy link
Author

r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Apr 22, 2022
@rust-highfive rust-highfive assigned dtolnay and unassigned kennytm Apr 22, 2022
@rustbot rustbot removed the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 22, 2022
@rust-log-analyzer

This comment has been minimized.

@the8472
Copy link
Member

the8472 commented Apr 23, 2022

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 os::linux::net instead.

@berendjan
Copy link
Author

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?

@the8472
Copy link
Member

the8472 commented Apr 23, 2022

There's the internal trait sys_common::AsInner to go from the public to the inner structs.

Edit: sorry, clicked the wrong button

@the8472 the8472 closed this Apr 23, 2022
@the8472 the8472 reopened this Apr 23, 2022
@berendjan
Copy link
Author

berendjan commented Apr 23, 2022 via email

@dtolnay dtolnay changed the title Branch for Issue #96256 setting TCP_QUICKACK Add setter and getter for TCP_QUICKACK on TcpStream for Linux and Android Apr 27, 2022
@dtolnay dtolnay added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 27, 2022
@rust-log-analyzer

This comment has been minimized.

@berendjan berendjan changed the title Add setter and getter for TCP_QUICKACK on TcpStream for Linux and Android Add setter and getter for TCP_QUICKACK on TcpStream for Linux May 1, 2022
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@berendjan
Copy link
Author

@the8472 hi, I finally got around to updating the PR, please let me know what I can improve!

/// .expect("Couldn't connect to the server...");
/// stream.set_quickack(true).expect("set_quickack call failed");
/// assert_eq!(stream.quickack().unwrap_or(false), true);
/// ```
Copy link
Member

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.

Copy link
Author

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?

Copy link
Member

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?

Copy link
Author

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

pub fn quickack(&self) -> io::Result<bool> {
self.inner.quickack()
}

Copy link
Member

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 cfgs, instead the linux::net module should do enough unwrapping steps to get to the os::unix types directly.

Copy link
Author

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

@berendjan
Copy link
Author

FYI I added doc to the cfg include for net module (std/src/os/mod.rs) and AsInner to imports (std/src/sys_common/net.rs)

@berendjan
Copy link
Author

@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 doc to std/src/os/mod.rs, I figured that was the problem since it couldn't find during doc generation.

@Dylan-DPC
Copy link
Member

i think it is better to get a final review from the reviewer first

@dtolnay
Copy link
Member

dtolnay commented Aug 26, 2022

@bors r+ rollup=iffy

@bors
Copy link
Collaborator

bors commented Aug 26, 2022

📌 Commit 786e875 has been approved by dtolnay

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 26, 2022
@bors
Copy link
Collaborator

bors commented Aug 27, 2022

⌛ Testing commit 786e875 with merge 9f32407fb5588105af3dff88fa37a0aa5a7a66ea...

@bors
Copy link
Collaborator

bors commented Aug 28, 2022

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 28, 2022
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@berendjan
Copy link
Author

@dtolnay I don't understand the error, what happend?

@dtolnay
Copy link
Member

dtolnay commented Aug 28, 2022

Not sure. @bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2022
@bors
Copy link
Collaborator

bors commented Aug 28, 2022

⌛ Testing commit 786e875 with merge ee285ea...

@bors
Copy link
Collaborator

bors commented Aug 28, 2022

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing ee285ea to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 28, 2022
@bors bors merged commit ee285ea into rust-lang:master Aug 28, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 28, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ee285ea): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.1% [2.7%, 6.8%] 3
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

Cycles

Results

This 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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.1% [-2.1%, -2.1%] 1

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@berendjan berendjan deleted the set_tcp_quickack branch August 29, 2022 18:50
@berendjan berendjan restored the set_tcp_quickack branch August 29, 2022 18:51
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.