Use the cancellation token in AuthenticateAsServerAsync (#15426)

This commit is contained in:
David Fowler 2019-10-29 11:08:07 -07:00 committed by GitHub
parent 0da5fabdbd
commit b0d6b0edf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -152,7 +152,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
var sslStream = sslDuplexPipe.Stream; var sslStream = sslDuplexPipe.Stream;
using (var cancellationTokeSource = new CancellationTokenSource(_options.HandshakeTimeout)) using (var cancellationTokeSource = new CancellationTokenSource(_options.HandshakeTimeout))
using (cancellationTokeSource.Token.UnsafeRegister(state => ((ConnectionContext)state).Abort(), context))
{ {
try try
{ {
@ -197,7 +196,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
_options.OnAuthenticate?.Invoke(context, sslOptions); _options.OnAuthenticate?.Invoke(context, sslOptions);
await sslStream.AuthenticateAsServerAsync(sslOptions, CancellationToken.None); await sslStream.AuthenticateAsServerAsync(sslOptions, cancellationTokeSource.Token);
} }
catch (OperationCanceledException) catch (OperationCanceledException)
{ {