From: Domagoj Pensa Date: Thu, 24 Dec 2020 11:59:10 +0000 (+0100) Subject: Remove 1 second delay before running netsh X-Git-Tag: v2.5.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7641f9b53bb6075fe7be7d5e6d16378eabebabd;p=thirdparty%2Fopenvpn.git Remove 1 second delay before running netsh When running various netsh commands before each 1 second sleep is added. As more netsh commands are run, especially for Wintun adapters, that can add to a noticable delayed connecting time. This should be safe. No problems were found in tests and all netsh commands executed properly with delay removed. Also, no delays are used in a similar code in interactive service and netsh command executions are guarded with a semaphore. Instead of removing management_sleep(1), management_sleep(0) is used as a replacement to allow processing any pending actions on the management interface without any wait. Signed-off-by: Domagoj Pensa Acked-by: Lev Stipakov Message-Id: <20201224115910.10129-1-domagoj@pensa.hr> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21405.html Signed-off-by: Gert Doering (cherry picked from commit b1a8213ee3fe35a4617608ec7653e4dffea79207) --- diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index eff4bd099..1bcc14472 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -5212,7 +5212,7 @@ netsh_command(const struct argv *a, int n, int msglevel) for (i = 0; i < n; ++i) { bool status; - management_sleep(1); + management_sleep(0); netcmd_semaphore_lock(); argv_msg_prefix(M_INFO, a, "NETSH"); status = openvpn_execve_check(a, NULL, 0, "ERROR: netsh command failed");