-
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
Additional QuicConnectionOptions #94211
Additional QuicConnectionOptions #94211
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCloses #72984. Draft for now until we go through API review.
|
8791161
to
96dccbf
Compare
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 know it's a draft, but I might not have time to review this properly later.
src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnectionOptions.cs
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnectionOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnectionOptions.cs
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnectionOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnectionOptions.cs
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -93,6 +105,9 @@ static async ValueTask<QuicConnection> StartConnectAsync(QuicClientConnectionOpt | |||
private readonly ValueTaskSource _connectedTcs = new ValueTaskSource(); | |||
private readonly ValueTaskSource _shutdownTcs = new ValueTaskSource(); | |||
|
|||
private readonly CancellationTokenSource _shutdownCancellationTokenSource = new CancellationTokenSource(); |
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 think we might need to dispose _shutdownCancellationTokenSource
?
Also, the naming confuses me... It implies the cancellation of the connection's shutdown, but it's not, it's for cancelling the handshake in the Listener, right? (and it also means it's not needed on the client side?)
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.
It is used only for listener to cancel the connection options callback if peer closes the connection before the handshake. I did not find a way to put the CTS outside QuicConnection.
I will try to come up with a better name
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.
What do we do in SslStream case? Do we also react and cancel user callback when the client kills handshake in the meantime?
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.
With sslstream we don't check for client-side activity while invoking the callback. We would have to always have a pending read on the inner stream and check for errors there. SslStream passes in the same token as to AuthenticateAsClientAsync.
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.
Renamed to ConnectionShutdownToken
and added a comment
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. I think the last contentious thing is the _shutdownCancellationTokenSource
.
src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnectionOptions.cs
Show resolved
Hide resolved
Exception exception = await AssertThrowsQuicExceptionAsync(QuicError.ConnectionTimeout, async () => await listener.AcceptConnectionAsync()); | ||
Assert.Equal(SR.Format(SR.net_quic_handshake_timeout, QuicDefaults.HandshakeTimeout), exception.Message); | ||
QuicClientConnectionOptions clientOptions = CreateQuicClientOptions(listener.LocalEndPoint); | ||
clientOptions.HandshakeTimeout = clientShorterTimeout ? TimeSpan.FromSeconds(2) : TimeSpan.FromSeconds(20); |
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'm pretty sure this will eventually pop-up in CI report. Especially if you're asserting specific types of exception that should happen only in certain order of events depending on this timing.
But we can wait until we see it.
@@ -93,6 +105,9 @@ static async ValueTask<QuicConnection> StartConnectAsync(QuicClientConnectionOpt | |||
private readonly ValueTaskSource _connectedTcs = new ValueTaskSource(); | |||
private readonly ValueTaskSource _shutdownTcs = new ValueTaskSource(); | |||
|
|||
private readonly CancellationTokenSource _shutdownCancellationTokenSource = new CancellationTokenSource(); |
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.
What do we do in SslStream case? Do we also react and cancel user callback when the client kills handshake in the meantime?
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.
Thank you!
All CI failures are known build failures |
BTW, I assume this also fixes #70090 |
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, thanks
Closes #72984.
Closes #70090.
Adds:
The client times out as well.
Other improvements: