Use the cancellation token in AuthenticateAsServerAsync (#15426)
This commit is contained in:
parent
0da5fabdbd
commit
b0d6b0edf9
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue