On Mon, Nov 9, 2015 at 2:03 PM, Selva Nair <selva.n...@gmail.com> wrote: >> It's probably okay to just make CTRL-c generate a SIGTERM as F4 is >> already doing. >> >> James > > Thanks for the comment. > > In the interactive mode, the console is opened with no > ENABLE_PROCESSED_INPUT so ctrl-C will be delivered as key-board input > and could be handled just like F4. > > With nssm, the console is shared with nssm, so ctrl-C is delivered as > a signal. I'll send a patch handling both cases.
The patch is in the next email. Handling the key-board input is easy, but making the callback interrupt the event loop looks tricky. I am not well versed with the event handling in the code, so opted to generate a key-pressed event. If there is a better way please suggest. Simply calling throw_signal in the callback will work, but could take several seconds before its noticed. Tested on windows 7 with cmd-line use and start/stop with nssm. For nssm, the default delay after ctrl-C is 1500 msec which is not enough for the process to exit if exit-notify is being used. About 1 second per extit notify trials + an extra 1 second is suggested. src/openvpn/win32.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) -- 2.6.2