Hi, On Sun, Nov 22, 2015 at 10:18 AM, Gert Doering <g...@greenie.muc.de> wrote:
> Hi, > > On Mon, Nov 16, 2015 at 09:48:09PM -0500, Selva Nair wrote: > > v2 changes > > - cleaner, hopefully easier to get a code review :) > > - handles both console mode and service mode > > -- >8 -- > > > > Handle ctrl-C or ctrl-Break sent to the console as a SIGTERM. > > Depending on the console mode, windows delivers ctrl-C as a > > keyboard input or as a signal. We handle both cases. This allows > > graceful termination of openvpn from programs such as nssm. > > Works in both console mode and service mode. > > If I read this right, the new code uses WriteConsoleInput() only to > signal "hey, some work to do here, wake up!" without actually sending any > keypress-to-itself, and the signal itself is sent by throw_signal()? > Yes, that's the idea. This is certainly nicer :-) > Agree :) > > (Is it actually quicker as well, so does the nssm timeout still need to > be adjusted? Haven't seen feedback from Samuli here yet) > In my tests openvpn exit processing takes only a few hundred msec, but if exit-notify is enabled that adds about 1 to 2 seconds[*]. As that option could be pushed as well its safer to setup nssm with a delay of 2500 msec between ctrl-C and 'kill without prejudice' (aka Terminate). Thanks, Selva [*} actually with exit-notify n, it should only take n-1 seconds to send n notifies, but integer arithmetic makes it always a little more than n-1. And for some reason it appears to wait a second even if another notify doesn't have to be sent. I've not looked into that part of the code carefully...