-
Notifications
You must be signed in to change notification settings - Fork 177
fix(s2n-quic-transport): treat clean connection close as dc complete #3193
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
Open
boquan-fang
wants to merge
4
commits into
aws:main
Choose a base branch
from
boquan-fang:boquan-fang/stateless-fix-use-close-pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0e905ef
fix(s2n-quic-transport): treat clean connection close as dc complete
boquan-fang 978a025
fix: explicitly close the connecion if ConfirmComplete errors
boquan-fang ab9384e
address PR comments:
boquan-fang b4e967e
address PR comments:
boquan-fang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,9 @@ pub const DEFAULT_MTU: u16 = DEFAULT_BASE_MTU; | |
| pub const DEFAULT_PTO_JITTER_PERCENTAGE: u8 = 33; | ||
| const DEFAULT_INITIAL_RTT: Duration = Duration::from_millis(1); | ||
| const DC_QUIC_VERSION: u32 = 0; | ||
| /// Application error code the client uses to close a connection whose dcQUIC handshake did not | ||
| /// complete when `ConfirmComplete` failed or timed out. | ||
| const DC_HANDSHAKE_INCOMPLETE_ERROR: u32 = 1; | ||
| /// Number of threads used to make progress on the TLS handshake | ||
| pub const DEFAULT_THREAD_COUNT: usize = 0; | ||
|
|
||
|
|
@@ -534,10 +537,22 @@ impl HandshakeQueue { | |
| } | ||
| Ok(Err(e)) => { | ||
| // ConfirmComplete::wait_ready failed. We should treat the handshake as failed. | ||
| // | ||
| // Explicitly close instead of letting `connection` drop, which would emit a | ||
| // clean (no-error) CONNECTION_CLOSE. A clean close is the signal the server | ||
| // uses to complete the dc handshake when the token ACK is lost; since the | ||
| // handshake did not complete here, we must not send it. Any explicit close is | ||
| // emitted as an application CONNECTION_CLOSE (`connection::Error::Application`), | ||
| // which the server does not treat as completion. If the connection is already | ||
| // closed this is a no-op. | ||
| connection.close(DC_HANDSHAKE_INCOMPLETE_ERROR.into()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you check what this looks like on the server side in terms of rendering? I assume the default is going to be an integer or just 'application error', in which case it would be good to intercept that somewhere and include a better message in our logging. |
||
| return Err(e); | ||
| } | ||
| Err(_elapsed) => { | ||
| // Handshake timeout occurred. We should treat the handshake as failed. | ||
| // | ||
| // Close with an explicit error. This is the same reason as the first error case. | ||
| connection.close(DC_HANDSHAKE_INCOMPLETE_ERROR.into()); | ||
|
boquan-fang marked this conversation as resolved.
Outdated
|
||
| return Err(io::Error::new( | ||
| io::ErrorKind::TimedOut, | ||
| "ConfirmComplete handshake timeout", | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.