Small improvement to HttpsConnectionMiddleware (#14764)
- Dispatch using Task.Yield instead of Task.Run. Task.Yield no longer allocates a work item or delegate and doesn't break causality when looking at dumps while Task.Run does.
This commit is contained in:
parent
4e79a278e3
commit
677fb870fd
|
|
@ -78,13 +78,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
|||
_options = options;
|
||||
_logger = loggerFactory?.CreateLogger<HttpsConnectionMiddleware>();
|
||||
}
|
||||
public Task OnConnectionAsync(ConnectionContext context)
|
||||
public async Task OnConnectionAsync(ConnectionContext context)
|
||||
{
|
||||
return Task.Run(() => InnerOnConnectionAsync(context));
|
||||
}
|
||||
await Task.Yield();
|
||||
|
||||
private async Task InnerOnConnectionAsync(ConnectionContext context)
|
||||
{
|
||||
bool certificateRequired;
|
||||
var feature = new Core.Internal.TlsConnectionFeature();
|
||||
context.Features.Set<ITlsConnectionFeature>(feature);
|
||||
|
|
|
|||
Loading…
Reference in New Issue