mirror of https://github.com/winsw/winsw
Address another Milliseconds misusage (similar to #124)
parent
dfafc2790d
commit
2a07f6af5d
|
@ -473,9 +473,22 @@ namespace winsw
|
||||||
|
|
||||||
private void SignalShutdownPending()
|
private void SignalShutdownPending()
|
||||||
{
|
{
|
||||||
|
int effectiveWaitHint;
|
||||||
|
if (_descriptor.WaitHint.TotalMilliseconds > Int32.MaxValue)
|
||||||
|
{
|
||||||
|
Log.Warn("The requested WaitHint value (" + _descriptor.WaitHint.TotalMilliseconds + " ms) is greater that the max value " +
|
||||||
|
Int32.MaxValue + ". The value will be truncated");
|
||||||
|
effectiveWaitHint = Int32.MaxValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
effectiveWaitHint = (int)_descriptor.WaitHint.TotalMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IntPtr handle = ServiceHandle;
|
IntPtr handle = ServiceHandle;
|
||||||
_wrapperServiceStatus.checkPoint++;
|
_wrapperServiceStatus.checkPoint++;
|
||||||
_wrapperServiceStatus.waitHint = _descriptor.WaitHint.Milliseconds;
|
_wrapperServiceStatus.waitHint = effectiveWaitHint;
|
||||||
// WriteEvent("SignalShutdownPending " + wrapperServiceStatus.checkPoint + ":" + wrapperServiceStatus.waitHint);
|
// WriteEvent("SignalShutdownPending " + wrapperServiceStatus.checkPoint + ":" + wrapperServiceStatus.waitHint);
|
||||||
_wrapperServiceStatus.currentState = (int)State.SERVICE_STOP_PENDING;
|
_wrapperServiceStatus.currentState = (int)State.SERVICE_STOP_PENDING;
|
||||||
Advapi32.SetServiceStatus(handle, ref _wrapperServiceStatus);
|
Advapi32.SetServiceStatus(handle, ref _wrapperServiceStatus);
|
||||||
|
|
Loading…
Reference in New Issue