Moar stopping power, Timeout is total timout

This commit is contained in:
Ben Adams 2015-11-22 16:11:41 +00:00
parent 10490888d3
commit 858e5ab3a2
1 changed files with 6 additions and 4 deletions

View File

@ -64,16 +64,18 @@ namespace Microsoft.AspNet.Server.Kestrel
return;
}
var stepTimeout = (int)(timeout.TotalMilliseconds / 3);
Post(t => t.OnStop());
if (!_thread.Join((int)timeout.TotalMilliseconds))
if (!_thread.Join(stepTimeout))
{
try
{
Post(t => t.OnStopRude());
if (!_thread.Join((int)timeout.TotalMilliseconds))
if (!_thread.Join(stepTimeout))
{
Post(t => t.OnStopImmediate());
if (!_thread.Join((int)timeout.TotalMilliseconds))
if (!_thread.Join(stepTimeout))
{
#if NET451
_thread.Abort();
@ -85,7 +87,7 @@ namespace Microsoft.AspNet.Server.Kestrel
{
// REVIEW: Should we log something here?
// Until we rework this logic, ODEs are bound to happen sometimes.
if (!_thread.Join((int)timeout.TotalMilliseconds))
if (!_thread.Join(stepTimeout))
{
#if NET451
_thread.Abort();