Skip to contentSkip to conversation

RfD: speed up PUSH_REQUEST...

Openvpn-devel Gert Doering 2 participants 3 messages Jul 1, 2015 – Sep 17, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

experimenting with the MTU patch, I discovered that we basically sit idle for two seconds on the client between "TLS is up!" and "PUSH_REQUEST".

This is part due to the coarse granularity of, well, our coarse timers, but in part due to *two* timers having to fire...

- TLS is done, we schedule an "wait_for_connect" timer to fire in +1 second (init.c, do_init_timers())

- when that timer fires, 1 second after TLS completes, we set up *another* timer inside check_connection_established_dowork(), that is intended to fire in +1 second

- +1 second later, we send PUSH_REQUEST

due to the calling sequence and check_push_request() being called right after check_connection_established(), it seems to be fairly safe to just set up the event to "fire right away" (*having* the event is needed to be able to reset it to "fire again in +5 seconds").

So, with the patch below on top of the MTU patch, connection times to a server which is 150ms away from me went down from 5 seconds to 2 seconds
- which I consider quite significant :-)

Anyone better versed in the history of this code who can tell me whether this is safe, or why the extra delay is there?

gert

src/openvpn/forward.c +2 -2
index 6d459d2..e1571ec 100644
@@ -212,8 +212,8 @@ check_connection_established_dowork (struct context *c)
 					0);
 		}
 #endif
-	      /* send push request in 1 sec */
-	      event_timeout_init (&c->c2.push_request_interval, 1, now);
+	      /* fire up push request right away (already 1s delayed) */
+	      event_timeout_init (&c->c2.push_request_interval, 0, now);
 	      reset_coarse_timers (c);
 	    }
 	  else
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]...
#1 lore raw

Am 01.07.15 um 16:40 schrieb Gert Doering:

Quoted 39 lines

Hi,

experimenting with the MTU patch, I discovered that we basically sit idle for two seconds on the client between "TLS is up!" and "PUSH_REQUEST".

This is part due to the coarse granularity of, well, our coarse timers, but in part due to *two* timers having to fire...

- TLS is done, we schedule an "wait_for_connect" timer to fire in +1 second (init.c, do_init_timers())

- when that timer fires, 1 second after TLS completes, we set up *another* timer inside check_connection_established_dowork(), that is intended to fire in +1 second

- +1 second later, we send PUSH_REQUEST

due to the calling sequence and check_push_request() being called right after check_connection_established(), it seems to be fairly safe to just set up the event to "fire right away" (*having* the event is needed to be able to reset it to "fire again in +5 seconds").

So, with the patch below on top of the MTU patch, connection times to a server which is 150ms away from me went down from 5 seconds to 2 seconds
- which I consider quite significant :-)

Anyone better versed in the history of this code who can tell me whether this is safe, or why the extra delay is there?

gert

src/openvpn/forward.c +0 -0
index 6d459d2..e1571ec 100644

src/openvpn/forward.c check_connection_established_dowork (struct context *c) · line 219

Quoted 10 lines
src/openvpn/forward.c +2 -2
@@ -212,8 +212,8 @@ check_connection_established_dowork (struct context *c)
 					0);
 		}
 #endif
-	      /* send push request in 1 sec */
-	      event_timeout_init (&c->c2.push_request_interval, 1, now);
+	      /* fire up push request right away (already 1s delayed) */
+	      event_timeout_init (&c->c2.push_request_interval, 0, now);
 	      reset_coarse_timers (c);
 	    }
 	  else

ACK on the basis that it looks right and none of my Android users has a problem with this patch.

Arne

#2 lore raw
In reply to Gert Doering

Patch has been applied to the master branch.

commit afb93fac803fbab7406d3b2dff6d1f39365bca74

Author: Gert Doering
Date:   Wed Jul 1 17:40:39 2015 +0200
     Make client delay less before sending PUSH_REQUEST

     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9851
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering