Hi,

On Mon, Jun 13, 2016 at 10:34:49PM -0400, Selva Nair wrote:
> @@ -759,6 +762,8 @@ void
>  netcmd_semaphore_release (void)
>  {
>    semaphore_release (&netcmd_semaphore);
> +  /* netcmd_semaphore has max count of 1 - safe to close after release */
> +  semaphore_close (&netcmd_semaphore);
>  }

This should work, but it is more "aggressive" than I had in mind - releasing
the semaphore afer every single call, so when setting up lots of routes with
netsh.exe, we might end up opening and closing the semaphore "dozens" of
times.

How expensive / slow is this?  Has this significant impact?

My idea was to close the semaphore when the initialization phase is over,
like in init.c, initialization_sequence_completed(), in the existing
WIN32 block

#ifdef WIN32
  netcmd_semaphore_close();                     /* release handles */
  fork_register_dns_action (c->c1.tuntap);
#endif

or something like that.  Keeping your change to the "lock" call so it
is then reopened at tunnel teardown, but is not open while openvpn is
running in steady state.

But I'm open to "semaphores are cheap, we can just open/lock/release/close
it on every call" arguments :-)

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: signature.asc
Description: PGP signature

Reply via email to