Set error before changing state in SocketInput.AbortAwaiting
- This fixes a tight race where awaiting code might continue but not see the ODE that moved SocketInput into the completed state.
This commit is contained in:
parent
f42bb02f24
commit
f9d70e601c
|
|
@ -180,11 +180,12 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
|
|
||||||
public void AbortAwaiting()
|
public void AbortAwaiting()
|
||||||
{
|
{
|
||||||
|
_awaitableError = new ObjectDisposedException(nameof(SocketInput), "The request was aborted");
|
||||||
|
|
||||||
var awaitableState = Interlocked.Exchange(
|
var awaitableState = Interlocked.Exchange(
|
||||||
ref _awaitableState,
|
ref _awaitableState,
|
||||||
_awaitableIsCompleted);
|
_awaitableIsCompleted);
|
||||||
|
|
||||||
_awaitableError = new ObjectDisposedException(nameof(SocketInput), "The request was aborted");
|
|
||||||
_manualResetEvent.Set();
|
_manualResetEvent.Set();
|
||||||
|
|
||||||
if (awaitableState != _awaitableIsCompleted &&
|
if (awaitableState != _awaitableIsCompleted &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue