aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c52
1 files changed, 13 insertions, 39 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index 6f080a4d0..20b2e1890 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -3187,11 +3187,13 @@ send_verify_successor_message (void *cls,
3187 /* This task will be scheduled when the result for Verify Successor is received. */ 3187 /* This task will be scheduled when the result for Verify Successor is received. */
3188 send_verify_successor_task = GNUNET_SCHEDULER_NO_TASK; 3188 send_verify_successor_task = GNUNET_SCHEDULER_NO_TASK;
3189 3189
3190 /* After one round of verify successor, we do back off. */ 3190 if (send_verify_successor_retry_task == GNUNET_SCHEDULER_NO_TASK)
3191 send_verify_successor_retry_task = 3191 {
3192 GNUNET_SCHEDULER_add_delayed (verify_successor_retry_time, 3192 send_verify_successor_retry_task =
3193 &send_verify_successor_message, 3193 GNUNET_SCHEDULER_add_delayed (verify_successor_retry_time,
3194 NULL); 3194 &send_verify_successor_message,
3195 NULL);
3196 }
3195 successor = &finger_table[0]; 3197 successor = &finger_table[0];
3196 /* We are waiting for a confirmation from the notify message and we have not 3198 /* We are waiting for a confirmation from the notify message and we have not
3197 * crossed the wait time, then return. */ 3199 * crossed the wait time, then return. */
@@ -5001,7 +5003,6 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
5001 GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); 5003 GNUNET_STATISTICS_set (GDS_stats, key, succ, 0);
5002 GNUNET_free (key); 5004 GNUNET_free (key);
5003 } 5005 }
5004 // TODO: Schedule verify_successor
5005 if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) 5006 if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK)
5006 send_verify_successor_task = 5007 send_verify_successor_task =
5007 GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, 5008 GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time,
@@ -5031,7 +5032,6 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
5031 GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); 5032 GNUNET_STATISTICS_set (GDS_stats, key, succ, 0);
5032 GNUNET_free (key); 5033 GNUNET_free (key);
5033 } 5034 }
5034 // TODO: Schedule verify_successor
5035 if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) 5035 if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK)
5036 send_verify_successor_task = 5036 send_verify_successor_task =
5037 GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, 5037 GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time,
@@ -5083,16 +5083,9 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
5083 5083
5084 add_new_finger (probable_successor, trail_me_to_probable_succ, 5084 add_new_finger (probable_successor, trail_me_to_probable_succ,
5085 trail_me_to_probable_succ_len, trail_id, 0); 5085 trail_me_to_probable_succ_len, trail_id, 0);
5086 /* SUPUS We are sending notify message, but before sending the next request 5086
5087 we should wait for confirmation. */
5088 // TODO : remove the following commented part
5089// waiting_for_notify_confirmation = 1;
5090// current_successor = &finger_table[0];
5091// current_successor->wait_notify_confirmation =
5092// GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(),
5093// WAIT_NOTIFY_CONFIRMATION);
5094 struct SendNotifyContext *notify_ctx; 5087 struct SendNotifyContext *notify_ctx;
5095 5088
5096 notify_ctx = GNUNET_new(struct SendNotifyContext); 5089 notify_ctx = GNUNET_new(struct SendNotifyContext);
5097 5090
5098 notify_ctx->source_peer = my_identity; 5091 notify_ctx->source_peer = my_identity;
@@ -5105,12 +5098,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
5105 notify_ctx->succesor_trail_id = trail_id; 5098 notify_ctx->succesor_trail_id = trail_id;
5106 notify_ctx->target_friend = target_friend; 5099 notify_ctx->target_friend = target_friend;
5107 5100
5108// GDS_NEIGHBOURS_send_notify_new_successor (my_identity, probable_successor, 5101 // TODO: Check if we should verify before schedule if already scheduled.
5109// trail_me_to_probable_succ,
5110// trail_me_to_probable_succ_len,
5111// trail_id,
5112// target_friend);
5113
5114 GNUNET_SCHEDULER_add_now(&send_notify_new_successor, (void*)notify_ctx); 5102 GNUNET_SCHEDULER_add_now(&send_notify_new_successor, (void*)notify_ctx);
5115 5103
5116 return; 5104 return;
@@ -5205,24 +5193,14 @@ handle_dht_p2p_verify_successor_result(void *cls,
5205 /* I am the querying_peer. */ 5193 /* I am the querying_peer. */
5206 if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&querying_peer, &my_identity))) 5194 if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&querying_peer, &my_identity)))
5207 { 5195 {
5208 /* As we completed one round of verify successor, we can do backoff. */ 5196 /* Cancel Retry Task */
5209// verify_successor_next_send_time =
5210// GNUNET_TIME_STD_BACKOFF(verify_successor_next_send_time);
5211
5212 // Cancel Retry Task
5213 if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_retry_task) 5197 if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_retry_task)
5214 { 5198 {
5215 GNUNET_SCHEDULER_cancel(send_verify_successor_retry_task); 5199 GNUNET_SCHEDULER_cancel(send_verify_successor_retry_task);
5216 send_verify_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; 5200 send_verify_successor_retry_task = GNUNET_SCHEDULER_NO_TASK;
5217 } 5201 }
5218
5219 compare_and_update_successor (current_successor, 5202 compare_and_update_successor (current_successor,
5220 probable_successor, trail, trail_length); 5203 probable_successor, trail, trail_length);
5221
5222 // Schedule send_verify_successor_task in appropriate time.
5223// send_verify_successor_task = GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time,
5224// send_verify_successor_message, NULL);
5225
5226 return GNUNET_OK; 5204 return GNUNET_OK;
5227 } 5205 }
5228 5206
@@ -5230,7 +5208,8 @@ handle_dht_p2p_verify_successor_result(void *cls,
5230 if(NULL == (next_hop = 5208 if(NULL == (next_hop =
5231 GDS_ROUTING_get_next_hop (trail_id, trail_direction))) 5209 GDS_ROUTING_get_next_hop (trail_id, trail_direction)))
5232 { 5210 {
5233 //FIXME: Urgent in what case this is possible? 5211 /* Here it may happen that source peer has found a new successor, and removed
5212 the trail, Hence no entry found in the routing table. Fail silently.*/
5234 DEBUG(" NO ENTRY FOUND IN %s ROUTING TABLE for trail id %s, line", 5213 DEBUG(" NO ENTRY FOUND IN %s ROUTING TABLE for trail id %s, line",
5235 GNUNET_i2s(&my_identity), GNUNET_h2s(&trail_id), __LINE__); 5214 GNUNET_i2s(&my_identity), GNUNET_h2s(&trail_id), __LINE__);
5236 GNUNET_break_op(0); 5215 GNUNET_break_op(0);
@@ -5420,16 +5399,11 @@ handle_dht_p2p_notify_succ_confirmation (void *cls,
5420 GNUNET_free (notify_ctx); 5399 GNUNET_free (notify_ctx);
5421 send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; 5400 send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK;
5422 } 5401 }
5423
5424 // TODO: Schedule verify_successor task
5425 if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) 5402 if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK)
5426 send_verify_successor_task = 5403 send_verify_successor_task =
5427 GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, 5404 GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time,
5428 &send_verify_successor_message, 5405 &send_verify_successor_message,
5429 NULL); 5406 NULL);
5430
5431// waiting_for_notify_confirmation = 0;
5432 //FIXME: Should we reset the time out to 0?
5433 } 5407 }
5434 else 5408 else
5435 { 5409 {