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

feat(s2n-quic-dc): accept linger parameter instead of always setting it #2476

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Feb 17, 2025

Description of changes:

This changes the TCP APIs to take a linger parameter instead of always setting it to 0. This avoids issues where the last peer to send data reset streams before transmitting the entire thing - especially where the last chunk is large and can be blocked on things like CWIN and flow control.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camshaft camshaft force-pushed the camshaft/dc-linger-config branch from 215dc72 to 1490c9c Compare February 17, 2025 23:21
@camshaft camshaft marked this pull request as ready for review February 17, 2025 23:26
@camshaft camshaft force-pushed the camshaft/dc-linger-config branch from 1490c9c to 77b8e30 Compare February 17, 2025 23:42
@@ -116,7 +120,13 @@ where
let prev_stream = core::mem::replace(&mut self.stream, Some((stream, remote_address)));
let prev_ctx = core::mem::replace(&mut self.subscriber_ctx, Some(subscriber_ctx));

if let Some(remote_address) = prev_stream.map(|(_socket, remote_address)| remote_address) {
if let Some(remote_address) = prev_stream.map(|(socket, remote_address)| {
if linger.is_none() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if linger.is_none() {
if linger == Some(Duration::ZERO) {

Maybe? Or we should document what we actually mean by None otherwise I suspect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it more, it should be

if linger.is_none() || linger != Some(Duration::ZERO) {

Basically, we want to hard reset the connection if we drop an old stream for a new one. And the easiest way to do that is setting linger=0. So we only need to set the linger value to 0 if it wasn't already set to that.

@camshaft camshaft force-pushed the camshaft/dc-linger-config branch from 77b8e30 to bcec5f1 Compare February 18, 2025 18:16
@camshaft camshaft merged commit dad94a7 into main Feb 18, 2025
129 checks passed
@camshaft camshaft deleted the camshaft/dc-linger-config branch February 18, 2025 18:58
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.

2 participants