-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Merge several version of MsQuicStream SendAsync code #68772
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsFixes #55818. This PR extracts common code from several Send*Async methods
|
Test failures seem to be all some permission errors, no actual test failures as far as I can see |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
{ | ||
if (state.SendBufferMaxCount < count) | ||
{ | ||
NativeMemory.Free((void*)state.SendQuicBuffers); |
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 haven't looked much into this yet, but it feels like it might be better to wait for #68288 to go in to be able to reuse stuff like MsQuicBuffers
that was added 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.
That PR does not use them for buffers inside MsQuicStream
, and based on one of the comments it would be something for a follow-up PR. I probably don't mind much putting this on hold for a bit until that PR is merged, but that could take a while more.
Thoughts, @ManickaP?
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.
Yes, please wait with this on my PR.
Test failure is unrelated ( |
Putting this on hold until #68288 is in. |
I reused the |
fcf5b8c
to
491ce39
Compare
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Test failures are unrelated:
|
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.
In general looks good, thanks.
...braries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicBuffers.cs
Outdated
Show resolved
Hide resolved
...braries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicBuffers.cs
Outdated
Show resolved
Hide resolved
...braries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicBuffers.cs
Outdated
Show resolved
Hide resolved
...braries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicBuffers.cs
Show resolved
Hide resolved
...braries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicBuffers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs
Outdated
Show resolved
Hide resolved
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.
Looks good, thanks!
src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs
Outdated
Show resolved
Hide resolved
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.
LGTM modulo nits, thanks!
{ | ||
int count = buffers.Length; | ||
Reserve(count); | ||
_count = count; |
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.
Nit: I believe it is already part of Reserve(count)
_count = count; |
@@ -85,15 +81,19 @@ private sealed class State | |||
// Set once stream have been shutdown. | |||
public readonly TaskCompletionSource ShutdownCompletionSource = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); | |||
|
|||
public State() | |||
{ | |||
SendBuffers = new MsQuicBuffers(); |
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.
Any specific reason it should be in a constructor and not assigned on declaration as other fields?
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.
Putting = new MsQuicBuffers()
in the field initializer triggers "Don't assign default values" or similar warning, and leaving it uninitialized breaks because the MsQuicBuffers._handles
is null.
Fixes #55818.
This PR extracts common code from several
Send*Async
methods used to implementWriteAsync
into a singleWriteAsyncInternal
method.