diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-08-10 22:27:48 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-08-10 22:27:48 +0000 |
commit | c4120e884178ef03790baeab572570c9bb52c7c9 (patch) | |
tree | d6dbaa7ef24e250d72e3e6f4637e27db131e84bd | |
parent | d53ccdd5d7a7d663345c346c5d6d3a336ac997d1 (diff) | |
download | gnunet-c4120e884178ef03790baeab572570c9bb52c7c9.tar.gz gnunet-c4120e884178ef03790baeab572570c9bb52c7c9.zip |
xvine:fixes
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 77d2cf275..b022baad7 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -4006,19 +4006,17 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4006 | } | 4006 | } |
4007 | 4007 | ||
4008 | /* Check if you are present in the trail seen so far? */ | 4008 | /* Check if you are present in the trail seen so far? */ |
4009 | if(trail_length > 0) | 4009 | for (i = 0; i < trail_length ; i++) |
4010 | { | 4010 | { |
4011 | for (i = 0; i < trail_length ; i++) | 4011 | if(0 == GNUNET_CRYPTO_cmp_peer_identity(&trail_peer_list[i],&my_identity)) |
4012 | { | 4012 | { |
4013 | if(0 == GNUNET_CRYPTO_cmp_peer_identity(&trail_peer_list[i],&my_identity)) | ||
4014 | { | ||
4015 | //Here if you already were present in the trail. then you | 4013 | //Here if you already were present in the trail. then you |
4016 | // shoudl trail length to i + 1 | 4014 | // should trail length to i + 1 |
4017 | trail_length = i+1; | 4015 | trail_length = i+1; |
4018 | break; | 4016 | break; |
4019 | } | ||
4020 | } | 4017 | } |
4021 | } | 4018 | } |
4019 | |||
4022 | 4020 | ||
4023 | /* Is my routing table full? */ | 4021 | /* Is my routing table full? */ |
4024 | if (GNUNET_YES == GDS_ROUTING_threshold_reached()) | 4022 | if (GNUNET_YES == GDS_ROUTING_threshold_reached()) |
@@ -4086,6 +4084,16 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4086 | 4084 | ||
4087 | if (0 != GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &source)) | 4085 | if (0 != GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &source)) |
4088 | { | 4086 | { |
4087 | if(0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &trail_peer_list[trail_length -1 ])) | ||
4088 | { | ||
4089 | GDS_NEIGHBOURS_send_trail_setup (source, | ||
4090 | final_dest_finger_val, | ||
4091 | next_peer.best_known_destination, | ||
4092 | target_friend, trail_length, trail_peer_list, | ||
4093 | is_predecessor, trail_id, | ||
4094 | next_peer.trail_id); | ||
4095 | } | ||
4096 | else{ | ||
4089 | /* Add yourself to list of peers. */ | 4097 | /* Add yourself to list of peers. */ |
4090 | struct GNUNET_PeerIdentity peer_list[trail_length + 1]; | 4098 | struct GNUNET_PeerIdentity peer_list[trail_length + 1]; |
4091 | 4099 | ||
@@ -4099,6 +4107,7 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4099 | target_friend, trail_length + 1, peer_list, | 4107 | target_friend, trail_length + 1, peer_list, |
4100 | is_predecessor, trail_id, | 4108 | is_predecessor, trail_id, |
4101 | next_peer.trail_id); | 4109 | next_peer.trail_id); |
4110 | } | ||
4102 | } | 4111 | } |
4103 | else | 4112 | else |
4104 | GDS_NEIGHBOURS_send_trail_setup (source, | 4113 | GDS_NEIGHBOURS_send_trail_setup (source, |
@@ -4476,11 +4485,6 @@ check_for_duplicate_entries (const struct GNUNET_PeerIdentity *trail_1, | |||
4476 | joined_trail[i] = trail_2[j]; | 4485 | joined_trail[i] = trail_2[j]; |
4477 | } | 4486 | } |
4478 | 4487 | ||
4479 | /* THIS CODE IS ONLY FOR TESTNG. FIXME*/ | ||
4480 | for(i = 0; i < *joined_trail_len; i++) | ||
4481 | { | ||
4482 | GNUNET_assert(0 != GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &joined_trail[i])); | ||
4483 | } | ||
4484 | return joined_trail; | 4488 | return joined_trail; |
4485 | } | 4489 | } |
4486 | 4490 | ||