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