[Openvpn-devel,1/1] Exit management interface loop early on receiving 'remote MOD' message.

Message ID CAL3L06F7YvNHSFxWXrMFZf_8fSjmCH-RkMn1GXmLu7cW-G1=nw@mail.gmail.com
State New
Headers show
Series
  • [Openvpn-devel,1/1] Exit management interface loop early on receiving 'remote MOD' message.
Related show

Commit Message

Daniel Kaldor July 3, 2019, 2:50 p.m.
OpenVPN using management interface and running with
'management-query-remote' in the config will wait for a 'remote MOD'
or 'remote ACCEPT' message before continuing with connection.

Logs indicate that this stage of the connection process currently
takes ~1s to complete.
This seems to be because the management interface polling loop is
being run once unnecessarily after receiving 'remote MOD' message, and
is only exiting after 1s timeout is reached on final polling loop.

This change exits the polling loop early, immediately after receiving
'remote MOD' message and removes 1s delay in connection.


---
 src/openvpn/manage.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

                 man_check_for_signals(&signal_received);
--
2.9.3 (Apple Git-75)

Patch

diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 2d86dad..7343e8b 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -3348,7 +3348,13 @@  management_event_loop_n_seconds(struct
management *man, int sec)
         /* run command processing event loop */
         do
         {
-            man_standalone_event_loop(man, &signal_received, expire);
+            int status = -1;
+
+            status = man_standalone_event_loop(man, &signal_received, expire);
+            if (status > 0)
+            {
+                return;
+            }
             if (!signal_received)
             {