diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-08-21 11:59:31 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-08-21 11:59:31 +0000 |
commit | 967ed6ed4721a97d4d741820483149e9bda96f0b (patch) | |
tree | 9cc9d27b37ec6469036aa719f741f6448d8bf255 | |
parent | 6ad171117374cbe13b1feb6ee97d7a9535ed0d4e (diff) | |
download | gnunet-967ed6ed4721a97d4d741820483149e9bda96f0b.tar.gz gnunet-967ed6ed4721a97d4d741820483149e9bda96f0b.zip |
Fixing trail setup rejection
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 157 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_routing.c | 2 | ||||
-rw-r--r-- | src/dht/gnunet_dht_profiler.c | 18 |
3 files changed, 97 insertions, 80 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index b13c7bc3c..3f9c8dfd4 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -1674,7 +1674,7 @@ select_closest_predecessor (const struct GNUNET_PeerIdentity *peer1, | |||
1674 | // } | 1674 | // } |
1675 | } | 1675 | } |
1676 | 1676 | ||
1677 | #if 0 | 1677 | |
1678 | /** | 1678 | /** |
1679 | * | 1679 | * |
1680 | * | 1680 | * |
@@ -1695,7 +1695,7 @@ test_print_trail (struct GNUNET_PeerIdentity *trail, | |||
1695 | __FILE__, __func__,__LINE__,i,GNUNET_i2s(&print_peer)); | 1695 | __FILE__, __func__,__LINE__,i,GNUNET_i2s(&print_peer)); |
1696 | } | 1696 | } |
1697 | } | 1697 | } |
1698 | #endif | 1698 | |
1699 | 1699 | ||
1700 | #if 0 | 1700 | #if 0 |
1701 | /** | 1701 | /** |
@@ -1828,6 +1828,10 @@ select_finger_trail (struct FingerInfo *finger) | |||
1828 | if (GNUNET_NO == current_finger_trail->is_present) | 1828 | if (GNUNET_NO == current_finger_trail->is_present) |
1829 | continue; | 1829 | continue; |
1830 | 1830 | ||
1831 | /* SUPUS: I am not changing anything here. as i assume that in case we have | ||
1832 | a finger which is friend and we have trail length = 0, then it will | ||
1833 | be the first friend to which we send the request. As I have removed | ||
1834 | the condition in trail setup where we check for source is a friend. */ | ||
1831 | GNUNET_assert (NULL != | 1835 | GNUNET_assert (NULL != |
1832 | (friend = | 1836 | (friend = |
1833 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, | 1837 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
@@ -1872,7 +1876,9 @@ compare_finger_and_current_closest_peer (struct Closest_Peer *current_closest_pe | |||
1872 | if (GNUNET_NO == finger->is_present) | 1876 | if (GNUNET_NO == finger->is_present) |
1873 | continue; | 1877 | continue; |
1874 | 1878 | ||
1875 | /* FIXME write correct comment here */ | 1879 | /* SUPUS: As we have friend stored as finger also, it may happen that |
1880 | * friend corresponding to this finger has been chosen as the best | ||
1881 | * known destination, then just move to next element. */ | ||
1876 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&finger->finger_identity, | 1882 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&finger->finger_identity, |
1877 | ¤t_closest_peer->best_known_destination)) | 1883 | ¤t_closest_peer->best_known_destination)) |
1878 | continue; | 1884 | continue; |
@@ -1880,16 +1886,14 @@ compare_finger_and_current_closest_peer (struct Closest_Peer *current_closest_pe | |||
1880 | /* If I am my own finger, then ignore this finger. */ | 1886 | /* If I am my own finger, then ignore this finger. */ |
1881 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&finger->finger_identity, | 1887 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&finger->finger_identity, |
1882 | &my_identity)) | 1888 | &my_identity)) |
1883 | { | ||
1884 | /* FIXME: I think a peer should not select itself as its own identity ever. | ||
1885 | But it does select. Find out why??*/ | ||
1886 | //GNUNET_break (0); | ||
1887 | continue; | 1889 | continue; |
1888 | //return; | 1890 | |
1889 | } | ||
1890 | |||
1891 | /* If finger is a friend, then do nothing. As we have already checked | 1891 | /* If finger is a friend, then do nothing. As we have already checked |
1892 | * for each friend in compare_friend_and_current_successor(). */ | 1892 | * for each friend in compare_friend_and_current_successor(). |
1893 | * SUPUS: Here we have all the friends in the friend table. So even if | ||
1894 | * that friend is a finger, we have checked it with trail length = 0. | ||
1895 | * So its okay. No need to change anything here. Note: finger may have | ||
1896 | * trail length > 0 but its okay. */ | ||
1893 | if (NULL != (GNUNET_CONTAINER_multipeermap_get (friend_peermap, | 1897 | if (NULL != (GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
1894 | &finger->finger_identity))) | 1898 | &finger->finger_identity))) |
1895 | { | 1899 | { |
@@ -1901,6 +1905,8 @@ compare_finger_and_current_closest_peer (struct Closest_Peer *current_closest_pe | |||
1901 | current_closest_peer->destination_finger_value, | 1905 | current_closest_peer->destination_finger_value, |
1902 | current_closest_peer->is_predecessor); | 1906 | current_closest_peer->is_predecessor); |
1903 | 1907 | ||
1908 | /* SUPUS: Ideally if finger is a friend, but with trail length > 0, then | ||
1909 | also we have already handled the case in above condition. */ | ||
1904 | if (0 == GNUNET_CRYPTO_cmp_peer_identity(&finger->finger_identity, &closest_peer)) | 1910 | if (0 == GNUNET_CRYPTO_cmp_peer_identity(&finger->finger_identity, &closest_peer)) |
1905 | { | 1911 | { |
1906 | /* Choose one of the trail to reach to finger. */ | 1912 | /* Choose one of the trail to reach to finger. */ |
@@ -2520,10 +2526,12 @@ send_find_finger_trail_message (void *cls, | |||
2520 | struct FriendInfo *target_friend; | 2526 | struct FriendInfo *target_friend; |
2521 | struct GNUNET_HashCode trail_id; | 2527 | struct GNUNET_HashCode trail_id; |
2522 | struct GNUNET_HashCode intermediate_trail_id; | 2528 | struct GNUNET_HashCode intermediate_trail_id; |
2523 | unsigned int is_predecessor; | 2529 | unsigned int is_predecessor = 0; |
2524 | uint64_t finger_id_value; | 2530 | uint64_t finger_id_value; |
2525 | 2531 | ||
2526 | /* Schedule another send_find_finger_trail_message task. */ | 2532 | /* Schedule another send_find_finger_trail_message task. When we have seen |
2533 | * one round of fingers, then this time is exponentially backoff to reduce | ||
2534 | * traffic caused by this task. */ | ||
2527 | find_finger_trail_task_next_send_time.rel_value_us = | 2535 | find_finger_trail_task_next_send_time.rel_value_us = |
2528 | find_finger_trail_task_next_send_time.rel_value_us + | 2536 | find_finger_trail_task_next_send_time.rel_value_us + |
2529 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 2537 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
@@ -2545,12 +2553,9 @@ send_find_finger_trail_message (void *cls, | |||
2545 | } | 2553 | } |
2546 | 2554 | ||
2547 | finger_id_value = compute_finger_identity_value (current_search_finger_index); | 2555 | finger_id_value = compute_finger_identity_value (current_search_finger_index); |
2548 | |||
2549 | if (PREDECESSOR_FINGER_ID == current_search_finger_index) | 2556 | if (PREDECESSOR_FINGER_ID == current_search_finger_index) |
2550 | is_predecessor = 1; | 2557 | is_predecessor = 1; |
2551 | else | 2558 | |
2552 | is_predecessor = 0; | ||
2553 | |||
2554 | /* Generate a unique trail id for trail we are trying to setup. */ | 2559 | /* Generate a unique trail id for trail we are trying to setup. */ |
2555 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, | 2560 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, |
2556 | &trail_id, sizeof (trail_id)); | 2561 | &trail_id, sizeof (trail_id)); |
@@ -2828,6 +2833,8 @@ send_trail_teardown (struct FingerInfo *finger, | |||
2828 | if (0 != GNUNET_CRYPTO_cmp_peer_identity (next_hop, &friend->id) | 2833 | if (0 != GNUNET_CRYPTO_cmp_peer_identity (next_hop, &friend->id) |
2829 | && (0 == trail->trail_length)) | 2834 | && (0 == trail->trail_length)) |
2830 | { | 2835 | { |
2836 | //FIXME HERE WE GOT NEXT HOP FRM ROUTING TABLE, AND TRAIL ENGTH - 0, IT ITS | ||
2837 | // THE CASE WEHERE WE SET IT TO 0. | ||
2831 | DEBUG ("\n LINE NO: = %d, Friend not found for trail id %s of peer %s trail length = %d", | 2838 | DEBUG ("\n LINE NO: = %d, Friend not found for trail id %s of peer %s trail length = %d", |
2832 | __LINE__,GNUNET_h2s(&trail->trail_id), GNUNET_i2s(&my_identity),trail->trail_length); | 2839 | __LINE__,GNUNET_h2s(&trail->trail_id), GNUNET_i2s(&my_identity),trail->trail_length); |
2833 | return; | 2840 | return; |
@@ -2950,6 +2957,7 @@ add_new_finger (struct GNUNET_PeerIdentity finger_identity, | |||
2950 | if (NULL != GNUNET_CONTAINER_multipeermap_get (friend_peermap, | 2957 | if (NULL != GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
2951 | &finger_identity)) | 2958 | &finger_identity)) |
2952 | { | 2959 | { |
2960 | //FIXME: HERE WE SET TRAIL LENGTH TO 0, EVEN THOUGH IT HAS ENTRIES. | ||
2953 | new_entry->trail_list[0].trail_id = trail_id; | 2961 | new_entry->trail_list[0].trail_id = trail_id; |
2954 | new_entry->trails_count = 1; | 2962 | new_entry->trails_count = 1; |
2955 | new_entry->trail_list[0].is_present = GNUNET_YES; | 2963 | new_entry->trail_list[0].is_present = GNUNET_YES; |
@@ -3876,9 +3884,12 @@ get_local_best_known_next_hop (uint64_t final_dest_finger_val, | |||
3876 | 3884 | ||
3877 | next_hop = GDS_ROUTING_get_next_hop (intermediate_trail_id, | 3885 | next_hop = GDS_ROUTING_get_next_hop (intermediate_trail_id, |
3878 | GDS_ROUTING_SRC_TO_DEST); | 3886 | GDS_ROUTING_SRC_TO_DEST); |
3879 | /* It may happen that trail teardown message got delayed and hence, | 3887 | /* next_hop NULL is a valid case. This intermediate trail id is set by |
3880 | the previous hop sent the message over intermediate trail id.In that | 3888 | some other finger, and while this trail setup is in progress, that other |
3881 | case next_hop could be NULL. */ | 3889 | peer might have found a better trail ,and send trail teardown message |
3890 | across the network. In case we got the trail teardown message first, | ||
3891 | then next_hop will be NULL. A possible solution could be to keep track | ||
3892 | * of all removed trail id, and be sure that there is no other reason . */ | ||
3882 | if(NULL != next_hop) | 3893 | if(NULL != next_hop) |
3883 | { | 3894 | { |
3884 | peer.next_hop = *next_hop; | 3895 | peer.next_hop = *next_hop; |
@@ -3960,16 +3971,8 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3960 | trail_length = 0; | 3971 | trail_length = 0; |
3961 | } | 3972 | } |
3962 | 3973 | ||
3963 | /* Check if you are friend of source. */ | 3974 | /* SUPUS: remove the check that source is a friend, because again source |
3964 | if (trail_length >= 1) | 3975 | may become aware about it later. and by that time lookup may fail. */ |
3965 | { | ||
3966 | if(NULL != GNUNET_CONTAINER_multipeermap_get (friend_peermap, &source)) | ||
3967 | { | ||
3968 | /* If I am a friend, then I can be the first contact, so make | ||
3969 | trail length 0. We are going to add ourself later in the code.*/ | ||
3970 | trail_length = 0; | ||
3971 | } | ||
3972 | } | ||
3973 | 3976 | ||
3974 | /* Check if you are present in the trail seen so far? */ | 3977 | /* Check if you are present in the trail seen so far? */ |
3975 | for (i = 0; i < trail_length ; i++) | 3978 | for (i = 0; i < trail_length ; i++) |
@@ -3984,9 +3987,22 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3984 | /* Is my routing table full? */ | 3987 | /* Is my routing table full? */ |
3985 | if (GNUNET_YES == GDS_ROUTING_threshold_reached()) | 3988 | if (GNUNET_YES == GDS_ROUTING_threshold_reached()) |
3986 | { | 3989 | { |
3987 | GNUNET_assert (NULL != | 3990 | if (trail_length > 0) |
3988 | (target_friend = | 3991 | target_friend = |
3989 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer))); | 3992 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
3993 | &trail_peer_list[trail_length - 1]); | ||
3994 | else | ||
3995 | target_friend = | ||
3996 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, | ||
3997 | &source); | ||
3998 | |||
3999 | if(NULL == target_friend) | ||
4000 | { | ||
4001 | DEBUG ("\n friend not found"); | ||
4002 | GNUNET_break(0); | ||
4003 | return GNUNET_OK; | ||
4004 | } | ||
4005 | |||
3990 | GDS_NEIGHBOURS_send_trail_rejection (source, final_dest_finger_val, | 4006 | GDS_NEIGHBOURS_send_trail_rejection (source, final_dest_finger_val, |
3991 | my_identity, is_predecessor, | 4007 | my_identity, is_predecessor, |
3992 | trail_peer_list, trail_length, | 4008 | trail_peer_list, trail_length, |
@@ -4015,12 +4031,6 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4015 | return GNUNET_OK; | 4031 | return GNUNET_OK; |
4016 | } | 4032 | } |
4017 | 4033 | ||
4018 | if (NULL != GNUNET_CONTAINER_multipeermap_get (friend_peermap, | ||
4019 | &source)) | ||
4020 | { | ||
4021 | trail_length = 0; | ||
4022 | } | ||
4023 | |||
4024 | if (trail_length > 0) | 4034 | if (trail_length > 0) |
4025 | target_friend = | 4035 | target_friend = |
4026 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, | 4036 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
@@ -4044,10 +4054,14 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4044 | } | 4054 | } |
4045 | else /* I'm not the final destination. */ | 4055 | else /* I'm not the final destination. */ |
4046 | { | 4056 | { |
4047 | GNUNET_assert (NULL != | 4057 | target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
4048 | (target_friend = | 4058 | &next_peer.next_hop); |
4049 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, | 4059 | if(NULL == target_friend) |
4050 | &next_peer.next_hop))); | 4060 | { |
4061 | DEBUG ("\n target friend not found for peer = %s", GNUNET_i2s(&next_peer.next_hop)); | ||
4062 | GNUNET_break (0); | ||
4063 | return GNUNET_OK; | ||
4064 | } | ||
4051 | 4065 | ||
4052 | if (0 != GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &source)) | 4066 | if (0 != GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &source)) |
4053 | { | 4067 | { |
@@ -5104,13 +5118,11 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5104 | size_t msize; | 5118 | size_t msize; |
5105 | 5119 | ||
5106 | msize = ntohs (message->size); | 5120 | msize = ntohs (message->size); |
5107 | /* We are passing the trail setup so far. */ | ||
5108 | if (msize < sizeof (struct PeerTrailRejectionMessage)) | 5121 | if (msize < sizeof (struct PeerTrailRejectionMessage)) |
5109 | { | 5122 | { |
5110 | GNUNET_break_op (0); | 5123 | GNUNET_break_op (0); |
5111 | return GNUNET_YES; | 5124 | return GNUNET_YES; |
5112 | } | 5125 | } |
5113 | |||
5114 | trail_rejection = (const struct PeerTrailRejectionMessage *) message; | 5126 | trail_rejection = (const struct PeerTrailRejectionMessage *) message; |
5115 | if ((msize - sizeof (struct PeerTrailRejectionMessage)) % | 5127 | if ((msize - sizeof (struct PeerTrailRejectionMessage)) % |
5116 | sizeof (struct GNUNET_PeerIdentity) != 0) | 5128 | sizeof (struct GNUNET_PeerIdentity) != 0) |
@@ -5120,7 +5132,6 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5120 | } | 5132 | } |
5121 | trail_length = (msize - sizeof (struct PeerTrailRejectionMessage))/ | 5133 | trail_length = (msize - sizeof (struct PeerTrailRejectionMessage))/ |
5122 | sizeof (struct GNUNET_PeerIdentity); | 5134 | sizeof (struct GNUNET_PeerIdentity); |
5123 | |||
5124 | GNUNET_STATISTICS_update (GDS_stats, | 5135 | GNUNET_STATISTICS_update (GDS_stats, |
5125 | gettext_noop | 5136 | gettext_noop |
5126 | ("# Bytes received from other peers"), msize, | 5137 | ("# Bytes received from other peers"), msize, |
@@ -5133,7 +5144,6 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5133 | trail_id = trail_rejection->trail_id; | 5144 | trail_id = trail_rejection->trail_id; |
5134 | ultimate_destination_finger_value = | 5145 | ultimate_destination_finger_value = |
5135 | GNUNET_ntohll (trail_rejection->ultimate_destination_finger_value); | 5146 | GNUNET_ntohll (trail_rejection->ultimate_destination_finger_value); |
5136 | |||
5137 | /* First set the congestion time of the friend that sent you this message. */ | 5147 | /* First set the congestion time of the friend that sent you this message. */ |
5138 | target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer); | 5148 | target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer); |
5139 | if (NULL == target_friend) | 5149 | if (NULL == target_friend) |
@@ -5154,10 +5164,15 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5154 | /* If I am congested then pass this message to peer before me in trail. */ | 5164 | /* If I am congested then pass this message to peer before me in trail. */ |
5155 | if(GNUNET_YES == GDS_ROUTING_threshold_reached()) | 5165 | if(GNUNET_YES == GDS_ROUTING_threshold_reached()) |
5156 | { | 5166 | { |
5167 | /* First remove yourself from the trail. */ | ||
5168 | unsigned int new_trail_length = trail_length - 1; | ||
5169 | struct GNUNET_PeerIdentity trail[new_trail_length]; | ||
5170 | |||
5171 | memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity)); | ||
5157 | if (0 == trail_length) | 5172 | if (0 == trail_length) |
5158 | next_peer = source; | 5173 | next_peer = source; |
5159 | else | 5174 | else |
5160 | next_peer = trail_peer_list[trail_length-1]; | 5175 | next_peer = trail[new_trail_length-1]; |
5161 | 5176 | ||
5162 | target_friend = | 5177 | target_friend = |
5163 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, &next_peer); | 5178 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, &next_peer); |
@@ -5170,7 +5185,7 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5170 | GDS_NEIGHBOURS_send_trail_rejection (source, | 5185 | GDS_NEIGHBOURS_send_trail_rejection (source, |
5171 | ultimate_destination_finger_value, | 5186 | ultimate_destination_finger_value, |
5172 | my_identity, is_predecessor, | 5187 | my_identity, is_predecessor, |
5173 | trail_peer_list,trail_length,trail_id, | 5188 | trail, new_trail_length, trail_id, |
5174 | target_friend, CONGESTION_TIMEOUT); | 5189 | target_friend, CONGESTION_TIMEOUT); |
5175 | return GNUNET_OK; | 5190 | return GNUNET_OK; |
5176 | } | 5191 | } |
@@ -5182,13 +5197,21 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5182 | if (0 == (GNUNET_CRYPTO_cmp_peer_identity (&successor.best_known_destination, | 5197 | if (0 == (GNUNET_CRYPTO_cmp_peer_identity (&successor.best_known_destination, |
5183 | &my_identity))) | 5198 | &my_identity))) |
5184 | { | 5199 | { |
5185 | if (0 == trail_length) | 5200 | /*Here you are already part of trail. Copy the trail removing yourself. */ |
5201 | unsigned int new_trail_length = trail_length - 1; | ||
5202 | struct GNUNET_PeerIdentity trail[new_trail_length]; | ||
5203 | |||
5204 | memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity)); | ||
5205 | |||
5206 | if (0 == new_trail_length) | ||
5186 | next_peer = source; | 5207 | next_peer = source; |
5187 | else | 5208 | else |
5188 | next_peer = trail_peer_list[trail_length-1]; | 5209 | { |
5189 | 5210 | next_peer = trail[new_trail_length-1]; | |
5211 | } | ||
5190 | target_friend = | 5212 | target_friend = |
5191 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, &next_peer); | 5213 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, &next_peer); |
5214 | |||
5192 | if (NULL == target_friend) | 5215 | if (NULL == target_friend) |
5193 | { | 5216 | { |
5194 | DEBUG ("\nLINE = %d ,No friend found.",__LINE__); | 5217 | DEBUG ("\nLINE = %d ,No friend found.",__LINE__); |
@@ -5197,19 +5220,15 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5197 | } | 5220 | } |
5198 | GDS_NEIGHBOURS_send_trail_setup_result (source, | 5221 | GDS_NEIGHBOURS_send_trail_setup_result (source, |
5199 | my_identity, | 5222 | my_identity, |
5200 | target_friend, trail_length, | 5223 | target_friend, new_trail_length, |
5201 | trail_peer_list, | 5224 | trail, |
5202 | is_predecessor, | 5225 | is_predecessor, |
5203 | ultimate_destination_finger_value, | 5226 | ultimate_destination_finger_value, |
5204 | trail_id); | 5227 | trail_id); |
5205 | } | 5228 | } |
5206 | else | 5229 | else |
5207 | { | 5230 | { |
5208 | struct GNUNET_PeerIdentity peer_list[trail_length + 1]; | 5231 | /* Here I was already part of trail. So no need to add. */ |
5209 | |||
5210 | memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity)); | ||
5211 | peer_list[trail_length] = my_identity; | ||
5212 | |||
5213 | target_friend = | 5232 | target_friend = |
5214 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, | 5233 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, |
5215 | &successor.next_hop); | 5234 | &successor.next_hop); |
@@ -5219,10 +5238,11 @@ handle_dht_p2p_trail_setup_rejection (void *cls, | |||
5219 | GNUNET_break(0); | 5238 | GNUNET_break(0); |
5220 | return GNUNET_OK; | 5239 | return GNUNET_OK; |
5221 | } | 5240 | } |
5241 | |||
5222 | GDS_NEIGHBOURS_send_trail_setup (source, | 5242 | GDS_NEIGHBOURS_send_trail_setup (source, |
5223 | ultimate_destination_finger_value, | 5243 | ultimate_destination_finger_value, |
5224 | successor.best_known_destination, | 5244 | successor.best_known_destination, |
5225 | target_friend, trail_length + 1, peer_list, | 5245 | target_friend, trail_length, trail_peer_list, |
5226 | is_predecessor, trail_id, | 5246 | is_predecessor, trail_id, |
5227 | successor.trail_id); | 5247 | successor.trail_id); |
5228 | } | 5248 | } |
@@ -5616,8 +5636,6 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer_identity) | |||
5616 | if (0 == memcmp (&my_identity, peer_identity, sizeof (struct GNUNET_PeerIdentity))) | 5636 | if (0 == memcmp (&my_identity, peer_identity, sizeof (struct GNUNET_PeerIdentity))) |
5617 | return; | 5637 | return; |
5618 | 5638 | ||
5619 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected to %s\n", GNUNET_i2s (peer_identity)); | ||
5620 | |||
5621 | /* If peer already exists in our friend_peermap, then exit. */ | 5639 | /* If peer already exists in our friend_peermap, then exit. */ |
5622 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (friend_peermap, | 5640 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (friend_peermap, |
5623 | peer_identity)) | 5641 | peer_identity)) |
@@ -5628,12 +5646,14 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer_identity) | |||
5628 | 5646 | ||
5629 | friend = GNUNET_new (struct FriendInfo); | 5647 | friend = GNUNET_new (struct FriendInfo); |
5630 | friend->id = *peer_identity; | 5648 | friend->id = *peer_identity; |
5631 | |||
5632 | GNUNET_assert (GNUNET_OK == | 5649 | GNUNET_assert (GNUNET_OK == |
5633 | GNUNET_CONTAINER_multipeermap_put (friend_peermap, | 5650 | GNUNET_CONTAINER_multipeermap_put (friend_peermap, |
5634 | peer_identity, friend, | 5651 | peer_identity, friend, |
5635 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 5652 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
5636 | 5653 | ||
5654 | /* SUPUS: We should add a congestion timestamp on the friend, so that it is | ||
5655 | selected after some time out. This is to ensure that both peers have added | ||
5656 | each other as their friend. */ | ||
5637 | /* got a first connection, good time to start with FIND FINGER TRAIL requests...*/ | 5657 | /* got a first connection, good time to start with FIND FINGER TRAIL requests...*/ |
5638 | if (GNUNET_SCHEDULER_NO_TASK == find_finger_trail_task) | 5658 | if (GNUNET_SCHEDULER_NO_TASK == find_finger_trail_task) |
5639 | { | 5659 | { |
@@ -5653,13 +5673,6 @@ core_init (void *cls, | |||
5653 | const struct GNUNET_PeerIdentity *identity) | 5673 | const struct GNUNET_PeerIdentity *identity) |
5654 | { | 5674 | { |
5655 | my_identity = *identity; | 5675 | my_identity = *identity; |
5656 | |||
5657 | uint64_t my_id64; | ||
5658 | memcpy (&my_id64, &my_identity, sizeof (uint64_t)); | ||
5659 | my_id64 = GNUNET_ntohll (my_id64); | ||
5660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
5661 | "my_indentity = %s, my_id64=%llu\n",GNUNET_i2s(&my_identity),(unsigned long long)my_id64); | ||
5662 | |||
5663 | } | 5676 | } |
5664 | 5677 | ||
5665 | 5678 | ||
@@ -5739,6 +5752,9 @@ delete_finger_table_entries() | |||
5739 | if(GNUNET_NO == finger_table[i].is_present) | 5752 | if(GNUNET_NO == finger_table[i].is_present) |
5740 | continue; | 5753 | continue; |
5741 | 5754 | ||
5755 | /* FREE ALL THE TRAILS. */ | ||
5756 | /* SUPUS: Here in free trail, it will delete the entry | ||
5757 | if there is a trail with trail length != 0.OKAY */ | ||
5742 | for(j = 0; j < finger_table[i].trails_count; j++) | 5758 | for(j = 0; j < finger_table[i].trails_count; j++) |
5743 | { | 5759 | { |
5744 | free_trail(&finger_table[i].trail_list[i]); | 5760 | free_trail(&finger_table[i].trail_list[i]); |
@@ -5746,6 +5762,7 @@ delete_finger_table_entries() | |||
5746 | } | 5762 | } |
5747 | } | 5763 | } |
5748 | 5764 | ||
5765 | |||
5749 | /** | 5766 | /** |
5750 | * Shutdown neighbours subsystem. | 5767 | * Shutdown neighbours subsystem. |
5751 | */ | 5768 | */ |
diff --git a/src/dht/gnunet-service-xdht_routing.c b/src/dht/gnunet-service-xdht_routing.c index 5e1516e4c..f56928f27 100644 --- a/src/dht/gnunet-service-xdht_routing.c +++ b/src/dht/gnunet-service-xdht_routing.c | |||
@@ -45,7 +45,7 @@ | |||
45 | /** | 45 | /** |
46 | * Maximum number of entries in routing table. | 46 | * Maximum number of entries in routing table. |
47 | */ | 47 | */ |
48 | #define ROUTING_TABLE_THRESHOLD 1000 | 48 | #define ROUTING_TABLE_THRESHOLD 80000 |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * FIXME: Store friend pointer instead of peer identifier. | 51 | * FIXME: Store friend pointer instead of peer identifier. |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index cd234fb75..7889042e0 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -376,7 +376,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
376 | for (cnt=0; cnt < num_peers; cnt++) | 376 | for (cnt=0; cnt < num_peers; cnt++) |
377 | { | 377 | { |
378 | if (NULL != a_ctx[cnt].op) | 378 | if (NULL != a_ctx[cnt].op) |
379 | GNUNET_TESTBED_operation_done (a_ctx[cnt].op); | 379 | GNUNET_TESTBED_operation_done (a_ctx[cnt].op); //FIXME: assertion fails. |
380 | 380 | ||
381 | /* Cleanup active context if this peer is an active peer */ | 381 | /* Cleanup active context if this peer is an active peer */ |
382 | ac = a_ctx[cnt].ac; | 382 | ac = a_ctx[cnt].ac; |
@@ -447,12 +447,8 @@ bandwidth_stats_iterator (void *cls, | |||
447 | outgoing_bandwidth = outgoing_bandwidth + value; | 447 | outgoing_bandwidth = outgoing_bandwidth + value; |
448 | else if (0 == strncmp(s_recv, name, strlen (s_recv))) | 448 | else if (0 == strncmp(s_recv, name, strlen (s_recv))) |
449 | incoming_bandwidth = incoming_bandwidth + value; | 449 | incoming_bandwidth = incoming_bandwidth + value; |
450 | else | 450 | |
451 | return GNUNET_OK; | 451 | return GNUNET_OK; |
452 | DEBUG ("Bandwith - Out: %lu; In: %lu\n", | ||
453 | (unsigned long) outgoing_bandwidth, | ||
454 | (unsigned long) incoming_bandwidth); | ||
455 | return GNUNET_OK; | ||
456 | } | 452 | } |
457 | 453 | ||
458 | 454 | ||
@@ -696,7 +692,7 @@ dht_connected (void *cls, | |||
696 | struct ActiveContext *ac = cls; | 692 | struct ActiveContext *ac = cls; |
697 | struct Context *ctx = ac->ctx; | 693 | struct Context *ctx = ac->ctx; |
698 | 694 | ||
699 | GNUNET_assert (NULL != ctx); | 695 | GNUNET_assert (NULL != ctx); //FIXME: Fails |
700 | GNUNET_assert (NULL != ctx->op); | 696 | GNUNET_assert (NULL != ctx->op); |
701 | GNUNET_assert (ctx->op == op); | 697 | GNUNET_assert (ctx->op == op); |
702 | ac->dht = (struct GNUNET_DHT_Handle *) ca_result; | 698 | ac->dht = (struct GNUNET_DHT_Handle *) ca_result; |
@@ -823,6 +819,7 @@ successor_stats_cont (void *cls, | |||
823 | key = val; | 819 | key = val; |
824 | val = GNUNET_CONTAINER_multihashmap_get (successor_peer_hashmap, | 820 | val = GNUNET_CONTAINER_multihashmap_get (successor_peer_hashmap, |
825 | key); | 821 | key); |
822 | //FIXME: REMOVE ENTRY FROM HASHMAP | ||
826 | GNUNET_assert(NULL != val); | 823 | GNUNET_assert(NULL != val); |
827 | count++; | 824 | count++; |
828 | } | 825 | } |
@@ -849,7 +846,7 @@ successor_stats_cont (void *cls, | |||
849 | if (GNUNET_SCHEDULER_NO_TASK != successor_stats_task) | 846 | if (GNUNET_SCHEDULER_NO_TASK != successor_stats_task) |
850 | { | 847 | { |
851 | successor_stats_task = GNUNET_SCHEDULER_NO_TASK; | 848 | successor_stats_task = GNUNET_SCHEDULER_NO_TASK; |
852 | //FIXME: free hashmap | 849 | //FIXME: FREE HASHMAP |
853 | } | 850 | } |
854 | 851 | ||
855 | if(GNUNET_SCHEDULER_NO_TASK == successor_stats_task) | 852 | if(GNUNET_SCHEDULER_NO_TASK == successor_stats_task) |
@@ -972,6 +969,9 @@ service_started (void *cls, | |||
972 | DEBUG("Peers Started = %d; num_peers = %d \n", peers_started, num_peers); | 969 | DEBUG("Peers Started = %d; num_peers = %d \n", peers_started, num_peers); |
973 | if (GNUNET_SCHEDULER_NO_TASK == successor_stats_task && peers_started == num_peers) | 970 | if (GNUNET_SCHEDULER_NO_TASK == successor_stats_task && peers_started == num_peers) |
974 | { | 971 | { |
972 | //FIXME: Here we have started service on all the peers, now we should first | ||
973 | // call act malicious API on malicious peer context. it will just set, | ||
974 | // act_malicious to 1 in the selected peers. and then it exists | ||
975 | DEBUG("successor_stats_task \n"); | 975 | DEBUG("successor_stats_task \n"); |
976 | struct Collect_Stat_Context *collect_stat_cls = GNUNET_new(struct Collect_Stat_Context); | 976 | struct Collect_Stat_Context *collect_stat_cls = GNUNET_new(struct Collect_Stat_Context); |
977 | collect_stat_cls->service_connect_ctx = cls; | 977 | collect_stat_cls->service_connect_ctx = cls; |