aboutsummaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-09-28 07:27:22 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-09-28 07:27:22 +0000
commite1e977f3cc52e230031f8770b0a9c977eab7db69 (patch)
treeb388e4c981ee17ebc53e4baf621b103cf839fc00 /init.c
parentEliminated the limitation on the number of options that can be pushed (diff)
downloadopenvpn-e1e977f3cc52e230031f8770b0a9c977eab7db69.tar.xz
Added --server-poll-timeout option : when polling possible remote
servers to connect to in a round-robin fashion, spend no more than n seconds waiting for a response before trying the next server. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@5010 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'init.c')
-rw-r--r--init.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/init.c b/init.c
index 9d29af7..20ca0a5 100644
--- a/init.c
+++ b/init.c
@@ -792,6 +792,11 @@ do_init_timers (struct context *c, bool deferred)
if (c->options.ping_rec_timeout)
event_timeout_init (&c->c2.ping_rec_interval, c->options.ping_rec_timeout, now);
+#if P2MP
+ if (c->options.server_poll_timeout)
+ event_timeout_init (&c->c2.server_poll_interval, c->options.server_poll_timeout, now);
+#endif
+
if (!deferred)
{
/* initialize connection establishment timer */
@@ -1444,10 +1449,15 @@ socket_restart_pause (struct context *c)
#if P2MP
if (auth_retry_get () == AR_NOINTERACT)
sec = 10;
+
+ if (c->options.server_poll_timeout && sec > 1)
+ sec = 1;
#endif
if (c->persist.restart_sleep_seconds > 0 && c->persist.restart_sleep_seconds > sec)
sec = c->persist.restart_sleep_seconds;
+ else if (c->persist.restart_sleep_seconds == -1)
+ sec = 0;
c->persist.restart_sleep_seconds = 0;
/* do managment hold on context restart, i.e. second, third, fourth, etc. initialization */