correct currentState required/test beep on success

git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@27 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308fa
remotes/git-svn
jjasper4 2009-01-28 21:28:10 +00:00
parent 54c4a25951
commit 3b4052df0d
1 changed files with 16 additions and 4 deletions

20
Main.cs
View File

@ -571,7 +571,7 @@ namespace winsw
WaitForProcessToExit(process);
WaitForProcessToExit(stopProcess);
// Console.Beep();
Console.Beep();
}
}
@ -581,22 +581,34 @@ namespace winsw
try
{
while (process.WaitForExit(3000))
while (process.WaitForExit(1000))
{
SignalShutdownPending();
}
}
catch (InvalidOperationException)
catch (InvalidOperationException ex)
{
WriteEvent("already terminated", ex);
// already terminated
}
SignalShutdownComplete();
}
private void SignalShutdownPending()
{
IntPtr handle = this.ServiceHandle;
wrapperServiceStatus.checkPoint++;
wrapperServiceStatus.waitHint = 5000;
wrapperServiceStatus.waitHint = 10000;
wrapperServiceStatus.currentState = (int)State.SERVICE_STOP_PENDING;
SetServiceStatus(handle, ref wrapperServiceStatus);
}
private void SignalShutdownComplete()
{
IntPtr handle = this.ServiceHandle;
wrapperServiceStatus.checkPoint++;
wrapperServiceStatus.currentState = (int)State.SERVICE_STOPPED;
SetServiceStatus(handle, ref wrapperServiceStatus);
}