Prevent DebugAssertException from blocks not returned by non-graceful shutdowns (#667).

This commit is contained in:
Cesar Blum Silveira 2016-03-03 08:56:22 -08:00 committed by Cesar Blum Silveira
parent 65f83015e3
commit cd8e8f0a11
3 changed files with 8 additions and 8 deletions

View File

@ -98,9 +98,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
listener._closed = true; listener._closed = true;
listener.ConnectionManager.WalkConnectionsAndClose(); listener.ConnectionManager.WalkConnectionsAndClose();
}, this); }, this).ConfigureAwait(false);
await ConnectionManager.WaitForConnectionCloseAsync(); await ConnectionManager.WaitForConnectionCloseAsync().ConfigureAwait(false);
await Thread.PostAsync(state => await Thread.PostAsync(state =>
{ {
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
{ {
writeReqPool.Dequeue().Dispose(); writeReqPool.Dequeue().Dispose();
} }
}, this); }, this).ConfigureAwait(false);
} }
Memory.Dispose(); Memory.Dispose();

View File

@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
{ {
// Call base first so the ListenSocket gets closed and doesn't // Call base first so the ListenSocket gets closed and doesn't
// try to dispatch connections to closed pipes. // try to dispatch connections to closed pipes.
await base.DisposeAsync(); await base.DisposeAsync().ConfigureAwait(false);
if (Thread.FatalError == null && ListenPipe != null) if (Thread.FatalError == null && ListenPipe != null)
{ {
@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
{ {
dispatchPipe.Dispose(); dispatchPipe.Dispose();
} }
}, this); }, this).ConfigureAwait(false);
} }
} }
} }

View File

@ -173,9 +173,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
listener._closed = true; listener._closed = true;
listener.ConnectionManager.WalkConnectionsAndClose(); listener.ConnectionManager.WalkConnectionsAndClose();
}, this); }, this).ConfigureAwait(false);
await ConnectionManager.WaitForConnectionCloseAsync(); await ConnectionManager.WaitForConnectionCloseAsync().ConfigureAwait(false);
await Thread.PostAsync(state => await Thread.PostAsync(state =>
{ {
@ -185,7 +185,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
{ {
writeReqPool.Dequeue().Dispose(); writeReqPool.Dequeue().Dispose();
} }
}, this); }, this).ConfigureAwait(false);
} }
else else
{ {