diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-08-27 19:21:10 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-08-27 19:21:10 +0000 |
commit | 5dccc937983b20b66e20a2c5bf228ca525b8979e (patch) | |
tree | e2f9ff7e023b8412b2a6ab7f23e8fbc44bb2563c /src | |
parent | 15518021ad63614a28fb9e766bb71bfa9f047e73 (diff) | |
download | gnunet-5dccc937983b20b66e20a2c5bf228ca525b8979e.tar.gz gnunet-5dccc937983b20b66e20a2c5bf228ca525b8979e.zip |
Exponential backoff
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 16 | ||||
-rw-r--r-- | src/dht/gnunet_dht_profiler.c | 15 | ||||
-rw-r--r-- | src/dht/gnunet_dht_r5n_profiler.c | 1 |
3 files changed, 21 insertions, 11 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 167ba5577..472007215 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -957,6 +957,10 @@ unsigned int act_malicious; | |||
957 | */ | 957 | */ |
958 | static unsigned int total_fingers_found; | 958 | static unsigned int total_fingers_found; |
959 | 959 | ||
960 | /** | ||
961 | * Number of times we found the same successor. | ||
962 | */ | ||
963 | static unsigned int successor_times; | ||
960 | 964 | ||
961 | /** | 965 | /** |
962 | * Called when core is ready to send a message we asked for | 966 | * Called when core is ready to send a message we asked for |
@@ -5058,6 +5062,16 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, | |||
5058 | GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); | 5062 | GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); |
5059 | GNUNET_free (key); | 5063 | GNUNET_free (key); |
5060 | } | 5064 | } |
5065 | |||
5066 | if(0 == successor_times) | ||
5067 | { | ||
5068 | verify_successor_next_send_time = | ||
5069 | GNUNET_TIME_STD_BACKOFF (verify_successor_next_send_time); | ||
5070 | } | ||
5071 | if (0 != successor_times) | ||
5072 | successor_times--; | ||
5073 | |||
5074 | |||
5061 | if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) | 5075 | if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) |
5062 | send_verify_successor_task = | 5076 | send_verify_successor_task = |
5063 | GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, | 5077 | GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, |
@@ -6059,7 +6073,7 @@ GDS_NEIGHBOURS_init (void) | |||
6059 | //TODO: check size of this peer map? | 6073 | //TODO: check size of this peer map? |
6060 | friend_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 6074 | friend_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
6061 | finger_table_init (); | 6075 | finger_table_init (); |
6062 | 6076 | successor_times = 10; | |
6063 | find_finger_trail_task_next_send_time.rel_value_us = | 6077 | find_finger_trail_task_next_send_time.rel_value_us = |
6064 | DHT_FIND_FINGER_TRAIL_INTERVAL.rel_value_us + | 6078 | DHT_FIND_FINGER_TRAIL_INTERVAL.rel_value_us + |
6065 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 6079 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index 53c120950..c5475c604 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -461,8 +461,6 @@ bandwidth_stats_iterator (void *cls, | |||
461 | static const char *s_sent = "# Bytes transmitted to other peers"; | 461 | static const char *s_sent = "# Bytes transmitted to other peers"; |
462 | static const char *s_recv = "# Bytes received from other peers"; | 462 | static const char *s_recv = "# Bytes received from other peers"; |
463 | 463 | ||
464 | DEBUG("inside bandwidth_stats_iterator()\n"); | ||
465 | |||
466 | if (0 == strncmp (s_sent, name, strlen (s_sent))) | 464 | if (0 == strncmp (s_sent, name, strlen (s_sent))) |
467 | outgoing_bandwidth = outgoing_bandwidth + value; | 465 | outgoing_bandwidth = outgoing_bandwidth + value; |
468 | else if (0 == strncmp(s_recv, name, strlen (s_recv))) | 466 | else if (0 == strncmp(s_recv, name, strlen (s_recv))) |
@@ -518,8 +516,6 @@ cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
518 | GNUNET_TESTBED_operation_done (ctx->op); | 516 | GNUNET_TESTBED_operation_done (ctx->op); |
519 | ctx->op = NULL; | 517 | ctx->op = NULL; |
520 | 518 | ||
521 | DEBUG("inside cancel_get()"); | ||
522 | |||
523 | /* If profiling is complete, summarize */ | 519 | /* If profiling is complete, summarize */ |
524 | if (n_active == n_gets_fail + n_gets_ok) | 520 | if (n_active == n_gets_fail + n_gets_ok) |
525 | { | 521 | { |
@@ -577,9 +573,9 @@ get_iter (void *cls, | |||
577 | GNUNET_TESTBED_operation_done (ctx->op); | 573 | GNUNET_TESTBED_operation_done (ctx->op); |
578 | ctx->op = NULL; | 574 | ctx->op = NULL; |
579 | 575 | ||
580 | total_put_path_length = total_put_path_length + put_path_length; | 576 | total_put_path_length = total_put_path_length + (double)put_path_length; |
581 | total_get_path_length = total_get_path_length + get_path_length; | 577 | total_get_path_length = total_get_path_length + (double)get_path_length; |
582 | 578 | DEBUG ("total_put_path_length = %f,put_path \n",total_put_path_length); | |
583 | /* Summarize if profiling is complete */ | 579 | /* Summarize if profiling is complete */ |
584 | if (n_active == n_gets_fail + n_gets_ok) | 580 | if (n_active == n_gets_fail + n_gets_ok) |
585 | { | 581 | { |
@@ -704,7 +700,7 @@ delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
704 | DEBUG ("PUT_REQUEST_START key %s \n", GNUNET_h2s((struct GNUNET_HashCode *)ac->put_data)); | 700 | DEBUG ("PUT_REQUEST_START key %s \n", GNUNET_h2s((struct GNUNET_HashCode *)ac->put_data)); |
705 | ac->dht_put = GNUNET_DHT_put (ac->dht, &ac->hash, | 701 | ac->dht_put = GNUNET_DHT_put (ac->dht, &ac->hash, |
706 | replication, | 702 | replication, |
707 | GNUNET_DHT_RO_NONE, | 703 | GNUNET_DHT_RO_RECORD_ROUTE, |
708 | GNUNET_BLOCK_TYPE_TEST, | 704 | GNUNET_BLOCK_TYPE_TEST, |
709 | ac->put_data_size, | 705 | ac->put_data_size, |
710 | ac->put_data, | 706 | ac->put_data, |
@@ -750,7 +746,6 @@ dht_connected (void *cls, | |||
750 | { | 746 | { |
751 | struct GNUNET_TIME_Relative peer_delay_put; | 747 | struct GNUNET_TIME_Relative peer_delay_put; |
752 | peer_delay_put.rel_value_us = | 748 | peer_delay_put.rel_value_us = |
753 | delay_put.rel_value_us + | ||
754 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 749 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
755 | delay_put.rel_value_us); | 750 | delay_put.rel_value_us); |
756 | ac->delay_task = GNUNET_SCHEDULER_add_delayed (peer_delay_put, &delayed_put, ac); | 751 | ac->delay_task = GNUNET_SCHEDULER_add_delayed (peer_delay_put, &delayed_put, ac); |
@@ -936,7 +931,7 @@ successor_stats_cont (void *cls, | |||
936 | NULL)); | 931 | NULL)); |
937 | 932 | ||
938 | successor_peer_hashmap = GNUNET_CONTAINER_multihashmap_create (num_peers, | 933 | successor_peer_hashmap = GNUNET_CONTAINER_multihashmap_create (num_peers, |
939 | GNUNET_NO); | 934 | GNUNET_NO); |
940 | //TODO:Check if comparison is correct. | 935 | //TODO:Check if comparison is correct. |
941 | if ((start_val == val) && (count == num_peers)) | 936 | if ((start_val == val) && (count == num_peers)) |
942 | { | 937 | { |
diff --git a/src/dht/gnunet_dht_r5n_profiler.c b/src/dht/gnunet_dht_r5n_profiler.c index 95528b3f9..f5278b3a6 100644 --- a/src/dht/gnunet_dht_r5n_profiler.c +++ b/src/dht/gnunet_dht_r5n_profiler.c | |||
@@ -602,6 +602,7 @@ dht_disconnect (void *cls, void *op_result) | |||
602 | GNUNET_assert (NULL != ac->dht); | 602 | GNUNET_assert (NULL != ac->dht); |
603 | GNUNET_assert (ac->dht == op_result); | 603 | GNUNET_assert (ac->dht == op_result); |
604 | GNUNET_DHT_disconnect (ac->dht); | 604 | GNUNET_DHT_disconnect (ac->dht); |
605 | ac->dht = NULL; | ||
605 | n_dht--; | 606 | n_dht--; |
606 | if (0 == n_dht) | 607 | if (0 == n_dht) |
607 | GNUNET_SCHEDULER_shutdown (); | 608 | GNUNET_SCHEDULER_shutdown (); |