summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSupriti Singh <supritisingh08@gmail.com>2014-08-27 19:21:10 +0000
committerSupriti Singh <supritisingh08@gmail.com>2014-08-27 19:21:10 +0000
commit5dccc937983b20b66e20a2c5bf228ca525b8979e (patch)
treee2f9ff7e023b8412b2a6ab7f23e8fbc44bb2563c /src
parent15518021ad63614a28fb9e766bb71bfa9f047e73 (diff)
Exponential backoff
Diffstat (limited to 'src')
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c16
-rw-r--r--src/dht/gnunet_dht_profiler.c15
-rw-r--r--src/dht/gnunet_dht_r5n_profiler.c1
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;
*/
static unsigned int total_fingers_found;
+/**
+ * Number of times we found the same successor.
+ */
+static unsigned int successor_times;
/**
* 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,
GNUNET_STATISTICS_set (GDS_stats, key, succ, 0);
GNUNET_free (key);
}
+
+ if(0 == successor_times)
+ {
+ verify_successor_next_send_time =
+ GNUNET_TIME_STD_BACKOFF (verify_successor_next_send_time);
+ }
+ if (0 != successor_times)
+ successor_times--;
+
+
if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK)
send_verify_successor_task =
GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time,
@@ -6059,7 +6073,7 @@ GDS_NEIGHBOURS_init (void)
//TODO: check size of this peer map?
friend_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
finger_table_init ();
-
+ successor_times = 10;
find_finger_trail_task_next_send_time.rel_value_us =
DHT_FIND_FINGER_TRAIL_INTERVAL.rel_value_us +
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,
static const char *s_sent = "# Bytes transmitted to other peers";
static const char *s_recv = "# Bytes received from other peers";
- DEBUG("inside bandwidth_stats_iterator()\n");
-
if (0 == strncmp (s_sent, name, strlen (s_sent)))
outgoing_bandwidth = outgoing_bandwidth + value;
else if (0 == strncmp(s_recv, name, strlen (s_recv)))
@@ -518,8 +516,6 @@ cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_TESTBED_operation_done (ctx->op);
ctx->op = NULL;
- DEBUG("inside cancel_get()");
-
/* If profiling is complete, summarize */
if (n_active == n_gets_fail + n_gets_ok)
{
@@ -577,9 +573,9 @@ get_iter (void *cls,
GNUNET_TESTBED_operation_done (ctx->op);
ctx->op = NULL;
- total_put_path_length = total_put_path_length + put_path_length;
- total_get_path_length = total_get_path_length + get_path_length;
-
+ total_put_path_length = total_put_path_length + (double)put_path_length;
+ total_get_path_length = total_get_path_length + (double)get_path_length;
+ DEBUG ("total_put_path_length = %f,put_path \n",total_put_path_length);
/* Summarize if profiling is complete */
if (n_active == n_gets_fail + n_gets_ok)
{
@@ -704,7 +700,7 @@ delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
DEBUG ("PUT_REQUEST_START key %s \n", GNUNET_h2s((struct GNUNET_HashCode *)ac->put_data));
ac->dht_put = GNUNET_DHT_put (ac->dht, &ac->hash,
replication,
- GNUNET_DHT_RO_NONE,
+ GNUNET_DHT_RO_RECORD_ROUTE,
GNUNET_BLOCK_TYPE_TEST,
ac->put_data_size,
ac->put_data,
@@ -750,7 +746,6 @@ dht_connected (void *cls,
{
struct GNUNET_TIME_Relative peer_delay_put;
peer_delay_put.rel_value_us =
- delay_put.rel_value_us +
GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
delay_put.rel_value_us);
ac->delay_task = GNUNET_SCHEDULER_add_delayed (peer_delay_put, &delayed_put, ac);
@@ -936,7 +931,7 @@ successor_stats_cont (void *cls,
NULL));
successor_peer_hashmap = GNUNET_CONTAINER_multihashmap_create (num_peers,
- GNUNET_NO);
+ GNUNET_NO);
//TODO:Check if comparison is correct.
if ((start_val == val) && (count == num_peers))
{
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)
GNUNET_assert (NULL != ac->dht);
GNUNET_assert (ac->dht == op_result);
GNUNET_DHT_disconnect (ac->dht);
+ ac->dht = NULL;
n_dht--;
if (0 == n_dht)
GNUNET_SCHEDULER_shutdown ();