-
Notifications
You must be signed in to change notification settings - Fork 673
Reliable reset: plumb FinalSize and enforce reset-equivalent flow-control accounting #6024
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
gaurav2699
wants to merge
6
commits into
main
Choose a base branch
from
reliablereset_finalsize
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 all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8fa9fae
fixed .net test issue for opensuse 16 and sles 16
gaurav2699 1071065
merge
gaurav2699 298714b
Merge branch 'main' of https://github.com/microsoft/msquic
gaurav2699 b053b33
Merge branch 'main' of https://github.com/microsoft/msquic
gaurav2699 37ea3bc
Added final size to QuicStreamProcessReliableResetFrame
gaurav2699 5573929
Fixed test issue
gaurav2699 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 |
|---|---|---|
|
|
@@ -189,6 +189,7 @@ _IRQL_requires_max_(PASSIVE_LEVEL) | |
| void | ||
| QuicStreamProcessReliableResetFrame( | ||
| _In_ QUIC_STREAM* Stream, | ||
| _In_ uint64_t FinalSize, | ||
| _In_ QUIC_VAR_INT ErrorCode, | ||
| _In_ QUIC_VAR_INT ReliableOffset | ||
| ) | ||
|
|
@@ -206,6 +207,70 @@ QuicStreamProcessReliableResetFrame( | |
| return; | ||
| } | ||
|
|
||
| if (FinalSize < ReliableOffset) { | ||
| QuicTraceLogStreamWarning( | ||
| ResetEarly, | ||
| Stream, | ||
| "Reliable reset has final size less than reliable offset!"); | ||
| QuicConnTransportError(Stream->Connection, QUIC_ERROR_FINAL_SIZE_ERROR); | ||
| return; | ||
| } | ||
|
|
||
| BOOLEAN CloseNow = Stream->RecvBuffer.BaseOffset >= ReliableOffset; | ||
|
|
||
| if (!Stream->Flags.RemoteCloseResetReliable && CloseNow) { | ||
| uint64_t TotalRecvLength = QuicRecvBufferGetTotalLength(&Stream->RecvBuffer); | ||
| if (TotalRecvLength > FinalSize) { | ||
| // | ||
| // The peer indicated a final offset less than what they have | ||
| // already sent to us. Kill the connection. | ||
| // | ||
| QuicTraceLogStreamWarning( | ||
| ResetEarly, | ||
| Stream, | ||
| "Tried to reset at earlier final size!"); | ||
| QuicConnTransportError(Stream->Connection, QUIC_ERROR_FINAL_SIZE_ERROR); | ||
| return; | ||
| } | ||
|
|
||
| if (TotalRecvLength < FinalSize) { | ||
| // | ||
| // The final offset is indicating that more data was sent than we | ||
| // have actually received. Make sure to update our flow control | ||
| // accounting so we stay in sync with the peer. | ||
| // | ||
| uint64_t FlowControlIncrease = FinalSize - TotalRecvLength; | ||
| Stream->Connection->Send.OrderedStreamBytesReceived += FlowControlIncrease; | ||
| if (Stream->Connection->Send.OrderedStreamBytesReceived < FlowControlIncrease || | ||
| Stream->Connection->Send.OrderedStreamBytesReceived > Stream->Connection->Send.MaxData) { | ||
| // | ||
| // The peer indicated a final offset more than allowed. Kill the | ||
| // connection. | ||
| // | ||
| QuicTraceLogStreamWarning( | ||
| ResetTooBig, | ||
| Stream, | ||
| "Tried to reset with too big final size!"); | ||
| QuicConnTransportError(Stream->Connection, QUIC_ERROR_FINAL_SIZE_ERROR); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| uint64_t TotalReadLength = Stream->RecvBuffer.BaseOffset; | ||
| if (TotalReadLength < FinalSize) { | ||
| // | ||
| // The final offset is indicating that more data was sent than the | ||
| // app has completely read. Make sure to give the peer more credit | ||
| // as a result. | ||
| // | ||
| uint64_t FlowControlIncrease = FinalSize - TotalReadLength; | ||
| Stream->Connection->Send.MaxData += FlowControlIncrease; | ||
|
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. I don't think we have a reason to give flow control here. More flow control will be granted as we receive bytes. |
||
| QuicSendSetSendFlag( | ||
| &Stream->Connection->Send, | ||
| QUIC_CONN_SEND_FLAG_MAX_DATA); | ||
| } | ||
| } | ||
|
|
||
| if (Stream->RecvMaxLength == 0 || ReliableOffset < Stream->RecvMaxLength) { | ||
| // | ||
| // As outlined in the spec, if we receive multiple CLOSE_STREAM frames, we only accept strictly | ||
|
|
@@ -735,6 +800,7 @@ QuicStreamRecv( | |
|
|
||
| QuicStreamProcessReliableResetFrame( | ||
| Stream, | ||
| Frame.FinalSize, | ||
| Frame.ErrorCode, | ||
| Frame.ReliableSize); | ||
|
|
||
|
|
||
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
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.
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.
Are you looking for
Stream->RecvMaxLength?