gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19409 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r19409 - gnunet/src/vpn
Date: Wed, 25 Jan 2012 21:26:21 +0100

Author: grothoff
Date: 2012-01-25 21:26:21 +0100 (Wed, 25 Jan 2012)
New Revision: 19409

Modified:
   gnunet/src/vpn/vpn_api.c
Log:
-use proper backoff to make VPN connect/start faster

Modified: gnunet/src/vpn/vpn_api.c
===================================================================
--- gnunet/src/vpn/vpn_api.c    2012-01-25 20:20:07 UTC (rev 19408)
+++ gnunet/src/vpn/vpn_api.c    2012-01-25 20:26:21 UTC (rev 19409)
@@ -64,6 +64,11 @@
   GNUNET_SCHEDULER_TaskIdentifier rt;
 
   /**
+   * How long do we wait until we try to reconnect?
+   */
+  struct GNUNET_TIME_Relative backoff;
+
+  /**
    * ID of the last request that was submitted to the service.
    */
   uint64_t request_id_gen;
@@ -402,7 +407,10 @@
   vh->request_id_gen = 0;
   for (rr = vh->rr_head; NULL != rr; rr = rr->next)
     rr->request_id = 0;
-  vh->rt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+  vh->backoff = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS,
+                                         GNUNET_TIME_relative_min 
(GNUNET_TIME_relative_multiply (vh->backoff, 2),
+                                                                   
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)));
+  vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff,
                                         &connect_task, 
                                         vh);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]