mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-21 19:01:16 +00:00
Calculate abortDate in one place. Make sure it takes the global terminate date (if any) into account. Fix bug clearing the global termination date (should never happen since, when that date is reached, the Command server should exit).
This commit is contained in:
parent
1ee2997360
commit
0fe10f12ed
1 changed files with 19 additions and 11 deletions
30
EcCommand.m
30
EcCommand.m
|
@ -107,6 +107,23 @@ static NSTimeInterval quitTime = 120.0;
|
|||
*/
|
||||
static NSDate *terminateBy = nil;
|
||||
|
||||
static NSTimeInterval
|
||||
abortDateFromStoppingDate(NSTimeInterval stopping)
|
||||
{
|
||||
NSTimeInterval abortDate = stopping + quitTime;
|
||||
|
||||
if (terminateBy)
|
||||
{
|
||||
NSTimeInterval ti = [terminateBy timeIntervalSinceReferenceDate];
|
||||
|
||||
if (ti < abortDate)
|
||||
{
|
||||
abortDate = ti;
|
||||
}
|
||||
}
|
||||
return abortDate;
|
||||
}
|
||||
|
||||
static NSUInteger launchLimit = 0;
|
||||
static BOOL launchEnabled = NO;
|
||||
static NSMutableDictionary *launchInfo = nil;
|
||||
|
@ -2315,7 +2332,7 @@ valgrindLog(NSString *name)
|
|||
{
|
||||
[self resetDelay];
|
||||
stoppingDate = [NSDate timeIntervalSinceReferenceDate];
|
||||
abortDate = stoppingDate + quitTime;
|
||||
abortDate = abortDateFromStoppingDate(stoppingDate);
|
||||
if (nil == client)
|
||||
{
|
||||
/* No connection to client established ... try to shut it down
|
||||
|
@ -2401,7 +2418,6 @@ valgrindLog(NSString *name)
|
|||
awakenedDate = 0.0;
|
||||
stableDate = 0.0;
|
||||
abortDate = 0.0;
|
||||
DESTROY(terminateBy); // Termination completed
|
||||
|
||||
if (clientLostDate > 0.0 || clientQuitDate > 0.0)
|
||||
{
|
||||
|
@ -2622,15 +2638,7 @@ valgrindLog(NSString *name)
|
|||
}
|
||||
if (abortDate <= 0.0)
|
||||
{
|
||||
abortDate = stoppingDate + quitTime;
|
||||
}
|
||||
if (nil != terminateBy)
|
||||
{
|
||||
ti = [terminateBy timeIntervalSinceReferenceDate];
|
||||
if (ti < abortDate)
|
||||
{
|
||||
abortDate = ti;
|
||||
}
|
||||
abortDate = abortDateFromStoppingDate(stoppingDate);
|
||||
}
|
||||
if (abortDate <= now)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue