aboutsummaryrefslogtreecommitdiff
path: root/src/vpn/vpn_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-25 20:26:21 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-25 20:26:21 +0000
commite4c99e0d5d4646e075cf343d7b890fe933045535 (patch)
tree2da43dc34d9a69244233b57678c824bf4f635898 /src/vpn/vpn_api.c
parentfe6ff968b06b317869ddf0779eb30ae7a1610f20 (diff)
downloadgnunet-e4c99e0d5d4646e075cf343d7b890fe933045535.tar.gz
gnunet-e4c99e0d5d4646e075cf343d7b890fe933045535.zip
-use proper backoff to make VPN connect/start faster
Diffstat (limited to 'src/vpn/vpn_api.c')
-rw-r--r--src/vpn/vpn_api.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c
index 494c6d857..81282960e 100644
--- a/src/vpn/vpn_api.c
+++ b/src/vpn/vpn_api.c
@@ -64,6 +64,11 @@ struct GNUNET_VPN_Handle
64 GNUNET_SCHEDULER_TaskIdentifier rt; 64 GNUNET_SCHEDULER_TaskIdentifier rt;
65 65
66 /** 66 /**
67 * How long do we wait until we try to reconnect?
68 */
69 struct GNUNET_TIME_Relative backoff;
70
71 /**
67 * ID of the last request that was submitted to the service. 72 * ID of the last request that was submitted to the service.
68 */ 73 */
69 uint64_t request_id_gen; 74 uint64_t request_id_gen;
@@ -402,7 +407,10 @@ reconnect (struct GNUNET_VPN_Handle *vh)
402 vh->request_id_gen = 0; 407 vh->request_id_gen = 0;
403 for (rr = vh->rr_head; NULL != rr; rr = rr->next) 408 for (rr = vh->rr_head; NULL != rr; rr = rr->next)
404 rr->request_id = 0; 409 rr->request_id = 0;
405 vh->rt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 410 vh->backoff = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS,
411 GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (vh->backoff, 2),
412 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)));
413 vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff,
406 &connect_task, 414 &connect_task,
407 vh); 415 vh);
408} 416}