diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-06 14:02:23 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-06 14:02:23 +0000 |
commit | c6aece5b114629ec170d205a5e8c3062df38716f (patch) | |
tree | 543ff13cd8b3a2818c6570c69a0328f07200060f /src | |
parent | 41d2fbdfcf63e1093a9ec4c8c3d948754d945350 (diff) | |
download | gnunet-c6aece5b114629ec170d205a5e8c3062df38716f.tar.gz gnunet-c6aece5b114629ec170d205a5e8c3062df38716f.zip |
exponential delay in offering HELLOs
Diffstat (limited to 'src')
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 0736f5997..4cea07acd 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c | |||
@@ -61,12 +61,6 @@ | |||
61 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30) | 61 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30) |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Timeout of Transport try_connect requests | ||
65 | */ | ||
66 | #define TRANSPORT_TRY_CONNECT_TIMEOUT \ | ||
67 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100) | ||
68 | |||
69 | /** | ||
70 | * The main context information associated with the client which started us | 64 | * The main context information associated with the client which started us |
71 | */ | 65 | */ |
72 | struct Context | 66 | struct Context |
@@ -442,6 +436,12 @@ struct OverlayConnectContext | |||
442 | * The id of peer B | 436 | * The id of peer B |
443 | */ | 437 | */ |
444 | uint32_t other_peer_id; | 438 | uint32_t other_peer_id; |
439 | |||
440 | /** | ||
441 | * Number of times we tried to send hello; used to increase delay in offering | ||
442 | * hellos | ||
443 | */ | ||
444 | uint16_t retries; | ||
445 | }; | 445 | }; |
446 | 446 | ||
447 | 447 | ||
@@ -478,6 +478,12 @@ struct RequestOverlayConnectContext | |||
478 | */ | 478 | */ |
479 | GNUNET_SCHEDULER_TaskIdentifier timeout_rocc_task_id; | 479 | GNUNET_SCHEDULER_TaskIdentifier timeout_rocc_task_id; |
480 | 480 | ||
481 | /** | ||
482 | * Number of times we tried to send hello; used to increase delay in offering | ||
483 | * hellos | ||
484 | */ | ||
485 | uint16_t retries; | ||
486 | |||
481 | }; | 487 | }; |
482 | 488 | ||
483 | 489 | ||
@@ -2225,8 +2231,10 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2225 | GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL); | 2231 | GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL); |
2226 | GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity); | 2232 | GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity); |
2227 | occ->send_hello_task = | 2233 | occ->send_hello_task = |
2228 | GNUNET_SCHEDULER_add_delayed (TRANSPORT_TRY_CONNECT_TIMEOUT, | 2234 | GNUNET_SCHEDULER_add_delayed |
2229 | &send_hello, occ); | 2235 | (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, |
2236 | 100 * (pow (2, occ->retries++))), | ||
2237 | &send_hello, occ); | ||
2230 | } | 2238 | } |
2231 | GNUNET_free (other_peer_str); | 2239 | GNUNET_free (other_peer_str); |
2232 | } | 2240 | } |
@@ -2594,8 +2602,10 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2594 | GNUNET_TRANSPORT_offer_hello (rocc->th, rocc->hello, NULL, NULL); | 2602 | GNUNET_TRANSPORT_offer_hello (rocc->th, rocc->hello, NULL, NULL); |
2595 | GNUNET_TRANSPORT_try_connect (rocc->th, &rocc->a_id); | 2603 | GNUNET_TRANSPORT_try_connect (rocc->th, &rocc->a_id); |
2596 | rocc->attempt_connect_task_id = | 2604 | rocc->attempt_connect_task_id = |
2597 | GNUNET_SCHEDULER_add_delayed (TRANSPORT_TRY_CONNECT_TIMEOUT, | 2605 | GNUNET_SCHEDULER_add_delayed |
2598 | &attempt_connect_task, rocc); | 2606 | (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, |
2607 | 100 * (pow (2, rocc->retries++))), | ||
2608 | &attempt_connect_task, rocc); | ||
2599 | } | 2609 | } |
2600 | 2610 | ||
2601 | 2611 | ||