diff options
Diffstat (limited to 'src/dht/gnunet-service-xdht_neighbours.c')
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 20b2e1890..e8452d134 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -3449,7 +3449,7 @@ finger_table_add (struct GNUNET_PeerIdentity finger_identity, | |||
3449 | successor = &finger_table[0]; | 3449 | successor = &finger_table[0]; |
3450 | if (GNUNET_NO == successor->is_present) | 3450 | if (GNUNET_NO == successor->is_present) |
3451 | { | 3451 | { |
3452 | GNUNET_break (0); | 3452 | GNUNET_break (0); //ASSERTION FAILS HERE. FIXME |
3453 | return; | 3453 | return; |
3454 | } | 3454 | } |
3455 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&finger_identity, | 3455 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&finger_identity, |
@@ -3707,11 +3707,13 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3707 | if (0 != (GNUNET_CRYPTO_cmp_peer_identity (¤t_best_known_dest, &my_identity))) | 3707 | if (0 != (GNUNET_CRYPTO_cmp_peer_identity (¤t_best_known_dest, &my_identity))) |
3708 | { | 3708 | { |
3709 | next_routing_hop = GDS_ROUTING_get_next_hop (intermediate_trail_id, | 3709 | next_routing_hop = GDS_ROUTING_get_next_hop (intermediate_trail_id, |
3710 | GDS_ROUTING_SRC_TO_DEST); | 3710 | GDS_ROUTING_SRC_TO_DEST); |
3711 | if (NULL != next_routing_hop) | 3711 | if (NULL != next_routing_hop) |
3712 | { | 3712 | { |
3713 | next_hop = next_routing_hop; | 3713 | next_hop = next_routing_hop; |
3714 | intermediate_trail_id = received_intermediate_trail_id; | 3714 | intermediate_trail_id = received_intermediate_trail_id; |
3715 | FPRINTF (stderr,_("\nSUPU %s, %s, %d,intermediate_trail_id=%s"),__FILE__, __func__,__LINE__,GNUNET_h2s(&intermediate_trail_id)); | ||
3716 | |||
3715 | best_known_dest = current_best_known_dest; | 3717 | best_known_dest = current_best_known_dest; |
3716 | } | 3718 | } |
3717 | } | 3719 | } |
@@ -4946,6 +4948,7 @@ struct SendNotifyContext | |||
4946 | unsigned int successor_trail_length; | 4948 | unsigned int successor_trail_length; |
4947 | struct GNUNET_HashCode succesor_trail_id; | 4949 | struct GNUNET_HashCode succesor_trail_id; |
4948 | struct FriendInfo *target_friend; | 4950 | struct FriendInfo *target_friend; |
4951 | unsigned int num_retries_scheduled; | ||
4949 | }; | 4952 | }; |
4950 | 4953 | ||
4951 | void | 4954 | void |
@@ -4995,11 +4998,21 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, | |||
4995 | char *my_id_str; | 4998 | char *my_id_str; |
4996 | uint64_t succ; | 4999 | uint64_t succ; |
4997 | char *key; | 5000 | char *key; |
4998 | 5001 | uint64_t my_id; | |
5002 | memcpy (&my_id, &my_identity, sizeof(uint64_t)); | ||
4999 | my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity)); | 5003 | my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity)); |
5000 | memcpy(&succ, ¤t_successor->finger_identity, sizeof(uint64_t)); | 5004 | memcpy(&succ, ¤t_successor->finger_identity, sizeof(uint64_t)); |
5001 | GNUNET_asprintf (&key, "XDHT:%s:", my_id_str); | 5005 | GNUNET_asprintf (&key, "XDHT:%s:", my_id_str); |
5002 | GNUNET_free (my_id_str); | 5006 | GNUNET_free (my_id_str); |
5007 | FPRINTF (stderr,_("\nSUPU %s, %s, %d,MY_ID = %llu and successor_id = %llu"), | ||
5008 | __FILE__, __func__,__LINE__,(unsigned long long)my_id, (unsigned long long)succ); | ||
5009 | struct GNUNET_PeerIdentity print_peer; | ||
5010 | print_peer = my_identity; | ||
5011 | FPRINTF (stderr,_("\nSUPU my_id = %s,my_id64 = %llu, %s, %s, %d"), | ||
5012 | GNUNET_i2s(&print_peer),(unsigned long long)my_id,__FILE__, __func__,__LINE__); | ||
5013 | print_peer = current_successor->finger_identity; | ||
5014 | FPRINTF (stderr,_("\nSUPU current_successor->finger_identity = %s,my_id64 = %llu, %s, %s, %d"), | ||
5015 | GNUNET_i2s(&print_peer),(unsigned long long)succ,__FILE__, __func__,__LINE__); | ||
5003 | GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); | 5016 | GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); |
5004 | GNUNET_free (key); | 5017 | GNUNET_free (key); |
5005 | } | 5018 | } |
@@ -5097,6 +5110,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, | |||
5097 | notify_ctx->successor_trail_length = trail_me_to_probable_succ_len; | 5110 | notify_ctx->successor_trail_length = trail_me_to_probable_succ_len; |
5098 | notify_ctx->succesor_trail_id = trail_id; | 5111 | notify_ctx->succesor_trail_id = trail_id; |
5099 | notify_ctx->target_friend = target_friend; | 5112 | notify_ctx->target_friend = target_friend; |
5113 | notify_ctx->num_retries_scheduled = 0; | ||
5100 | 5114 | ||
5101 | // TODO: Check if we should verify before schedule if already scheduled. | 5115 | // TODO: Check if we should verify before schedule if already scheduled. |
5102 | GNUNET_SCHEDULER_add_now(&send_notify_new_successor, (void*)notify_ctx); | 5116 | GNUNET_SCHEDULER_add_now(&send_notify_new_successor, (void*)notify_ctx); |
@@ -5120,7 +5134,8 @@ send_notify_new_successor (void *cls, | |||
5120 | ctx->succesor_trail_id, | 5134 | ctx->succesor_trail_id, |
5121 | ctx->target_friend); | 5135 | ctx->target_friend); |
5122 | 5136 | ||
5123 | if (send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) | 5137 | if (0 != ctx->num_retries_scheduled && |
5138 | send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) | ||
5124 | { | 5139 | { |
5125 | // Result from previous notify successos hasn't arrived, so the retry task | 5140 | // Result from previous notify successos hasn't arrived, so the retry task |
5126 | // hasn't been cancelled! Already a new notify successor must be called. | 5141 | // hasn't been cancelled! Already a new notify successor must be called. |
@@ -5132,9 +5147,10 @@ send_notify_new_successor (void *cls, | |||
5132 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; | 5147 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; |
5133 | } | 5148 | } |
5134 | 5149 | ||
5150 | ctx->num_retries_scheduled++; | ||
5135 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_add_delayed(notify_successor_retry_time, | 5151 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_add_delayed(notify_successor_retry_time, |
5136 | &send_notify_new_successor, | 5152 | &send_notify_new_successor, |
5137 | cls); | 5153 | cls); |
5138 | } | 5154 | } |
5139 | 5155 | ||
5140 | /* | 5156 | /* |