Remove sync block->task

await rather than synchronously blocking and then returning a
Task.FromResult
This commit is contained in:
Ben Adams 2015-11-10 16:24:13 +00:00
parent 0bfc97e46f
commit 344c821f83
1 changed files with 5 additions and 3 deletions

View File

@ -277,7 +277,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
OnCompleted(callback, state);
}
Task<Stream> IHttpUpgradeFeature.UpgradeAsync()
async Task<Stream> IHttpUpgradeFeature.UpgradeAsync()
{
StatusCode = 101;
ReasonPhrase = "Switching Protocols";
@ -290,8 +290,10 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
ResponseHeaders["Upgrade"] = values;
}
}
ProduceStartAndFireOnStarting(immediate: true).GetAwaiter().GetResult();
return Task.FromResult(DuplexStream);
await ProduceStartAndFireOnStarting(immediate: true);
return DuplexStream;
}
IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();