fixup error in last change, when -Wait not used

This commit is contained in:
Richard Frith-Macdonald 2019-05-15 15:16:26 +01:00
parent 2ce9916ae8
commit f320aece3a

View file

@ -133,33 +133,41 @@ main()
else else
{ {
NSConnection *c = [proxy connectionForProxy]; NSConnection *c = [proxy connectionForProxy];
NSTimeInterval seconds = [defs doubleForKey: @"Wait"];
unsigned active; unsigned active;
NSDate *by; NSDate *by;
if (isnan(seconds) || 0.0 == seconds) if (nil == [defs objectForKey: @"Wait"])
{ {
by = nil; by = nil; // No waiting, default grace period
} }
else if (seconds < 0.5) else
{ {
seconds = 0.5; NSTimeInterval seconds = [defs doubleForKey: @"Wait"];
}
else if (seconds > 900.0) if (isnan(seconds) || 0.0 == seconds)
{ {
seconds = 900.0; by = nil;
} }
by = [NSDate dateWithTimeIntervalSinceNow: seconds]; else if (seconds < 0.5)
{
seconds = 0.5;
}
else if (seconds > 900.0)
{
seconds = 900.0;
}
by = [NSDate dateWithTimeIntervalSinceNow: seconds];
}
if ([proxy respondsToSelector: @selector(activeCount)]) if ([proxy respondsToSelector: @selector(activeCount)])
{ {
active = [proxy activeCount]; active = [(id<Command>)proxy activeCount];
[(id<Command>)proxy terminate: by]; [(id<Command>)proxy terminate: by];
} }
else else
{ {
by = nil; // Waiting not supported with this API.
active = 0; active = 0;
[(id<EcCommandOld>)proxy terminate]; [(id<EcCommandOld>)proxy terminate];
by = nil; // Waiting not supported with this API.
} }
if (nil == by) if (nil == by)
{ {