Fix interactive service ignoring stop command if openvpn is running

Make the exit event not auto-reset so that the signal propagates to
all worker threads and finally to the main thread.

Fixes Trac #666

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1457241559-23374-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11317
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Selva Nair 2016-03-06 00:19:19 -05:00 committed by Gert Doering
parent 6370f70357
commit 239d09938b

View file

@ -1289,7 +1289,7 @@ ServiceStartInteractive (DWORD dwArgc, LPTSTR *lpszArgv)
goto out;
io_event = InitOverlapped (&overlapped);
exit_event = CreateEvent (NULL, FALSE, FALSE, NULL);
exit_event = CreateEvent (NULL, TRUE, FALSE, NULL);
if (!exit_event || !io_event)
{
error = MsgToEventLog (M_SYSERR, TEXT("Could not create event"));
@ -1356,6 +1356,7 @@ ServiceStartInteractive (DWORD dwArgc, LPTSTR *lpszArgv)
{
/* exit event signaled */
CloseHandleEx (&pipe);
ResetEvent (exit_event);
error = NO_ERROR;
break;
}