Skip to contentSkip to conversation

Update expiry date in management event loop

PATCH In review Thomas Veerman 3 participants 4 messages Jan 22, 2014 – Oct 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update expiry date in management event loop

When there are events from the management console with an interval shorter than 1 second, the event loop never stops as it keeps resetting event_wait.
---
 src/openvpn/manage.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/manage.c +0 -0
index 22dbe13..42a87c2 100644
@@ -2922,7 +2922,8 @@ management_event_loop_n_seconds (struct management *man, int sec)

     man_check_for_signals (&signal_received);
   if (signal_received)
     return;
- } while (expire);
+          update_time();
+ } while (expire && expire > now);

       /* revert state */ man->persist.standalone_disabled = standalone_disabled_save; --
1.7.12.4 (Apple Git-37)

#1 lore raw

The condition under which I encountered this was trying to set up a connection using "tcp-client" and then querying the management console every 500 milliseconds for the connection state. This would never proceed beyond TCP_CONNECT. If you query less than once per second it works fine.

When connecting with TCP, the code does a non-blocking connect. When you connect using UDP, you take a different path which does in fact update the expiry timer correctly.

--
Thomas

Quoted 32 lines · Thomas Veerman

When there are events from the management console with an interval shorter than 1 second, the event loop never stops as it keeps resetting event_wait.

---
 src/openvpn/manage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/manage.c +2 -1
index 22dbe13..42a87c2 100644
@@ -2922,7 +2922,8 @@ management_event_loop_n_seconds (struct management *man, int sec)
 	    man_check_for_signals (&signal_received);
 	  if (signal_received)
 	    return;
-	} while (expire);
+          update_time();
+	} while (expire && expire > now);
 
       /* revert state */
       man->persist.standalone_disabled = standalone_disabled_save;
Signature · 11 lines
1.7.12.4 (Apple Git-37)

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
#2 lore raw
In reply to Thomas Veerman

Am 22.01.14 um 09:27 schrieb Thomas Veerman:

Quoted 3 lines

When there are events from the management console with an interval shorter than 1 second, the event loop never stops as it keeps resetting event_wait.

ACK. It is a strange cornercase and the patch does not change behaviour otherwise.

Arne

Acked-by Arne Schwabe
#3 lore raw

Hi,

Quoted 6 lines · Arne Schwabe

Am 22.01.14 um 09:27 schrieb Thomas Veerman:

Quoted 2 lines

When there are events from the management console with an interval shorter than 1 second, the event loop never stops as it keeps resetting event_wait.

ACK. It is a strange cornercase and the patch does not change behaviour otherwise.

Thanks. Patch has been merged and pushed. (The formatting of the original mail was a bit funny and upset "git am", so my auto-reply- genereation failed either...)

commit b51a024a7b26e691e6459964d4d29f15b70089bd

Author: Thomas Veerman <[email protected]...>
Date:   Wed Jan 22 09:27:29 2014 +0100

Update expiry date in management event loop

When there are events from the management console with an interval shorter than 1 second, the event loop never stops as it keeps resetting event_wait.

Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8253

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...