gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24204 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r24204 - gnunet/src/testbed
Date: Sat, 6 Oct 2012 16:02:23 +0200

Author: harsha
Date: 2012-10-06 16:02:23 +0200 (Sat, 06 Oct 2012)
New Revision: 24204

Modified:
   gnunet/src/testbed/gnunet-service-testbed.c
Log:
exponential delay in offering HELLOs

Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-10-06 13:25:58 UTC (rev 
24203)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-10-06 14:02:23 UTC (rev 
24204)
@@ -61,12 +61,6 @@
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
 
 /**
- * Timeout of Transport try_connect requests
- */
-#define TRANSPORT_TRY_CONNECT_TIMEOUT                                   \
-  GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100)
-
-/**
  * The main context information associated with the client which started us
  */
 struct Context
@@ -442,6 +436,12 @@
    * The id of peer B
    */
   uint32_t other_peer_id;
+
+  /**
+   * Number of times we tried to send hello; used to increase delay in offering
+   * hellos
+   */
+  uint16_t retries;
 };
 
 
@@ -478,6 +478,12 @@
    */
   GNUNET_SCHEDULER_TaskIdentifier timeout_rocc_task_id;
   
+  /**
+   * Number of times we tried to send hello; used to increase delay in offering
+   * hellos
+   */
+  uint16_t retries;
+  
 };
 
 
@@ -2225,8 +2231,10 @@
     GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL);
     GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity);
     occ->send_hello_task =
-        GNUNET_SCHEDULER_add_delayed (TRANSPORT_TRY_CONNECT_TIMEOUT,
-                                      &send_hello, occ);
+        GNUNET_SCHEDULER_add_delayed
+        (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+                                        100 * (pow (2, occ->retries++))),
+         &send_hello, occ);
   }
   GNUNET_free (other_peer_str);  
 }
@@ -2594,8 +2602,10 @@
   GNUNET_TRANSPORT_offer_hello (rocc->th, rocc->hello, NULL, NULL);
   GNUNET_TRANSPORT_try_connect (rocc->th, &rocc->a_id);
   rocc->attempt_connect_task_id = 
-      GNUNET_SCHEDULER_add_delayed (TRANSPORT_TRY_CONNECT_TIMEOUT,
-                                    &attempt_connect_task, rocc);
+      GNUNET_SCHEDULER_add_delayed 
+      (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+                                      100 * (pow (2, rocc->retries++))),
+       &attempt_connect_task, rocc);
 }
 
 




reply via email to

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