aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSupriti Singh <supritisingh08@gmail.com>2014-08-01 12:38:42 +0000
committerSupriti Singh <supritisingh08@gmail.com>2014-08-01 12:38:42 +0000
commit976b38a9ed15d49b3565e2ee013ccb4e903bfb35 (patch)
treecc53fcffe739f34b8ba8b3e07063cb08b8098f14 /src
parent5af3601273f0ed5e4d0f4e3e7039525a7b7ff4b3 (diff)
downloadgnunet-976b38a9ed15d49b3565e2ee013ccb4e903bfb35.tar.gz
gnunet-976b38a9ed15d49b3565e2ee013ccb4e903bfb35.zip
x-vine:fixes
Diffstat (limited to 'src')
-rw-r--r--src/dht/gnunet-service-xdht_clients.c14
-rw-r--r--src/dht/gnunet-service-xdht_datacache.c3
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c62
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.h1
-rw-r--r--src/dht/gnunet_dht_profiler.c4
5 files changed, 33 insertions, 51 deletions
diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c
index 502223215..fd806eff7 100644
--- a/src/dht/gnunet-service-xdht_clients.c
+++ b/src/dht/gnunet-service-xdht_clients.c
@@ -501,6 +501,7 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
501 LOG (GNUNET_ERROR_TYPE_DEBUG, 501 LOG (GNUNET_ERROR_TYPE_DEBUG,
502 "Record type missmatch, not passing request for key %s to local client\n", 502 "Record type missmatch, not passing request for key %s to local client\n",
503 GNUNET_h2s (key)); 503 GNUNET_h2s (key));
504
504 GNUNET_STATISTICS_update (GDS_stats, 505 GNUNET_STATISTICS_update (GDS_stats,
505 gettext_noop 506 gettext_noop
506 ("# Key match, type mismatches in REPLY to CLIENT"), 507 ("# Key match, type mismatches in REPLY to CLIENT"),
@@ -955,10 +956,10 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
955 size - sizeof (struct GNUNET_DHT_ClientPutMessage), 956 size - sizeof (struct GNUNET_DHT_ClientPutMessage),
956 &put_msg[1]); 957 &put_msg[1]);
957 /* FIXME: Should we store locally? */ 958 /* FIXME: Should we store locally? */
958 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put_msg->expiration), 959/* GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put_msg->expiration),
959 &put_msg->key, 0, NULL, ntohl (put_msg->type), 960 &put_msg->key, 0, NULL, ntohl (put_msg->type),
960 size - sizeof (struct GNUNET_DHT_ClientPutMessage), 961 size - sizeof (struct GNUNET_DHT_ClientPutMessage),
961 &put_msg[1]); 962 &put_msg[1]);*/
962 963
963 struct GNUNET_PeerIdentity my_identity = GDS_NEIGHBOURS_get_my_id(); 964 struct GNUNET_PeerIdentity my_identity = GDS_NEIGHBOURS_get_my_id();
964 struct GNUNET_PeerIdentity best_known_destination; 965 struct GNUNET_PeerIdentity best_known_destination;
@@ -1338,7 +1339,7 @@ handle_dht_local_monitor_stop (void *cls, struct GNUNET_SERVER_Client *client,
1338 1339
1339#if ENABLE_MALICIOUS 1340#if ENABLE_MALICIOUS
1340/** 1341/**
1341 * Handler for monitor stop messages 1342 * Handler for act malicous message.
1342 * 1343 *
1343 * @param cls closure for the service 1344 * @param cls closure for the service
1344 * @param client the client we received this message from 1345 * @param client the client we received this message from
@@ -1350,7 +1351,12 @@ handle_dht_act_malicious (void *cls, struct GNUNET_SERVER_Client *client,
1350 const struct GNUNET_MessageHeader *message) 1351 const struct GNUNET_MessageHeader *message)
1351{ 1352{
1352 /* FIXME: parse message and set malicious */ 1353 /* FIXME: parse message and set malicious */
1353 malicious = 1; 1354 const struct GNUNET_DHT_ActMaliciousMessage *msg;
1355 unsigned int malicious;
1356
1357 msg = (const struct GNUNET_DHT_ActMaliciousMessage *)message;
1358 malicious = msg->action;
1359 GDS_NEIGHBOURS_act_malicious(malicious);
1354} 1360}
1355#endif 1361#endif
1356 1362
diff --git a/src/dht/gnunet-service-xdht_datacache.c b/src/dht/gnunet-service-xdht_datacache.c
index 9c7249fdf..6c3b8adeb 100644
--- a/src/dht/gnunet-service-xdht_datacache.c
+++ b/src/dht/gnunet-service-xdht_datacache.c
@@ -62,7 +62,7 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
62 const void *data) 62 const void *data)
63{ 63{
64 int r; 64 int r;
65 65
66 if (NULL == datacache) 66 if (NULL == datacache)
67 { 67 {
68 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 68 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -74,6 +74,7 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
74 GNUNET_break (0); 74 GNUNET_break (0);
75 return; 75 return;
76 } 76 }
77
77 /* Put size is actual data size plus struct overhead plus path length (if any) */ 78 /* Put size is actual data size plus struct overhead plus path length (if any) */
78 GNUNET_STATISTICS_update (GDS_stats, 79 GNUNET_STATISTICS_update (GDS_stats,
79 gettext_noop ("# ITEMS stored in datacache"), 1, 80 gettext_noop ("# ITEMS stored in datacache"), 1,
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index 646d02bd4..5234129a4 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -714,9 +714,6 @@ struct Trail_Element
714}; 714};
715 715
716/** 716/**
717 * FIXME: removed first_friend_trails_count, need to write a function
718 * to calculate each time we need it. Else, keep a pointer to first
719 * friend of in the trail.
720 * Information about an individual trail. 717 * Information about an individual trail.
721 */ 718 */
722struct Trail 719struct Trail
@@ -888,7 +885,6 @@ static unsigned int current_search_finger_index;
888 */ 885 */
889unsigned int track_topology; 886unsigned int track_topology;
890 887
891
892/** 888/**
893 * Called when core is ready to send a message we asked for 889 * Called when core is ready to send a message we asked for
894 * out to the destination. 890 * out to the destination.
@@ -2139,7 +2135,7 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
2139 GNUNET_break (0); 2135 GNUNET_break (0);
2140 return; 2136 return;
2141 } 2137 }
2142 2138
2143 /* This is the first call made from clients file. So, we should search for the 2139 /* This is the first call made from clients file. So, we should search for the
2144 target_friend. */ 2140 target_friend. */
2145 if (NULL == target_peer) 2141 if (NULL == target_peer)
@@ -2157,7 +2153,9 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
2157 2153
2158 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&best_known_dest, &my_identity)) 2154 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&best_known_dest, &my_identity))
2159 { 2155 {
2160 /* I am the destination but we have already done datacache_put in client file. */ 2156 /* I am the destination. */
2157 GDS_DATACACHE_handle_put (expiration_time, key, 0, NULL,
2158 ntohl (block_type),data_size,data);
2161 return; 2159 return;
2162 } 2160 }
2163 else 2161 else
@@ -2246,7 +2244,7 @@ GDS_NEIGHBOURS_send_get (const struct GNUNET_HashCode *key,
2246 GNUNET_break (0); 2244 GNUNET_break (0);
2247 return; 2245 return;
2248 } 2246 }
2249 2247
2250 /* This is the first time we got request from our own client file. */ 2248 /* This is the first time we got request from our own client file. */
2251 if (NULL == target_peer) 2249 if (NULL == target_peer)
2252 { 2250 {
@@ -2518,17 +2516,6 @@ send_find_finger_trail_message (void *cls,
2518 GNUNET_SCHEDULER_add_delayed (next_send_time, &send_find_finger_trail_message, 2516 GNUNET_SCHEDULER_add_delayed (next_send_time, &send_find_finger_trail_message,
2519 NULL); 2517 NULL);
2520 2518
2521 //FIXME: adding this check, so that once we found an entry for 0 and 64 then
2522 //don't schedule. Remove it afterwards.
2523 struct FingerInfo *succ;
2524 struct FingerInfo *pred;
2525 succ = &finger_table[0];
2526 pred = &finger_table[PREDECESSOR_FINGER_ID];
2527
2528 if((GNUNET_YES == succ->is_present) &&
2529 (GNUNET_YES == pred->is_present))
2530 return;
2531
2532 /* No space in my routing table. (Source and destination peers also store entries 2519 /* No space in my routing table. (Source and destination peers also store entries
2533 * in their routing table). */ 2520 * in their routing table). */
2534 if (GNUNET_YES == GDS_ROUTING_threshold_reached()) 2521 if (GNUNET_YES == GDS_ROUTING_threshold_reached())
@@ -3201,12 +3188,6 @@ update_current_search_finger_index (struct GNUNET_PeerIdentity finger_identity,
3201 /* Start looking for immediate predecessor. */ 3188 /* Start looking for immediate predecessor. */
3202 current_search_finger_index = PREDECESSOR_FINGER_ID; 3189 current_search_finger_index = PREDECESSOR_FINGER_ID;
3203 3190
3204 /* If I am not my own successor, then send a verify successor message. */
3205 //if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &finger_identity))
3206 //{
3207 //send_verify_successor_message (successor);
3208 //}
3209
3210 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &finger_identity)) 3191 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &finger_identity))
3211 { 3192 {
3212 if (GNUNET_SCHEDULER_NO_TASK == send_verify_successor_task) 3193 if (GNUNET_SCHEDULER_NO_TASK == send_verify_successor_task)
@@ -3507,7 +3488,8 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
3507 3488
3508 put = (struct PeerPutMessage *) message; 3489 put = (struct PeerPutMessage *) message;
3509 putlen = ntohl (put->put_path_length); 3490 putlen = ntohl (put->put_path_length);
3510 3491
3492
3511 if ((msize < 3493 if ((msize <
3512 sizeof (struct PeerPutMessage) + 3494 sizeof (struct PeerPutMessage) +
3513 putlen * sizeof (struct GNUNET_PeerIdentity)) || 3495 putlen * sizeof (struct GNUNET_PeerIdentity)) ||
@@ -3677,7 +3659,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3677 best_known_dest = get->best_known_destination; 3659 best_known_dest = get->best_known_destination;
3678 intermediate_trail_id = get->intermediate_trail_id; 3660 intermediate_trail_id = get->intermediate_trail_id;
3679 get_path = (const struct GNUNET_PeerIdentity *)&get[1]; 3661 get_path = (const struct GNUNET_PeerIdentity *)&get[1];
3680 3662
3681 if ((msize < 3663 if ((msize <
3682 sizeof (struct PeerGetMessage) + 3664 sizeof (struct PeerGetMessage) +
3683 get_length * sizeof (struct GNUNET_PeerIdentity)) || 3665 get_length * sizeof (struct GNUNET_PeerIdentity)) ||
@@ -3687,7 +3669,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3687 GNUNET_break_op (0); 3669 GNUNET_break_op (0);
3688 return GNUNET_YES; 3670 return GNUNET_YES;
3689 } 3671 }
3690 3672
3691 /* Add sender to get path */ 3673 /* Add sender to get path */
3692 struct GNUNET_PeerIdentity gp[get_length + 1]; 3674 struct GNUNET_PeerIdentity gp[get_length + 1];
3693 if (get_length > 0) 3675 if (get_length > 0)
@@ -3734,9 +3716,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3734 memcpy (final_get_path, gp, get_length * sizeof (struct GNUNET_PeerIdentity)); 3716 memcpy (final_get_path, gp, get_length * sizeof (struct GNUNET_PeerIdentity));
3735 memcpy (&final_get_path[get_length], &my_identity, sizeof (struct GNUNET_PeerIdentity)); 3717 memcpy (&final_get_path[get_length], &my_identity, sizeof (struct GNUNET_PeerIdentity));
3736 get_length = get_length + 1; 3718 get_length = get_length + 1;
3737 /* FIXME: here it may happen that we find our identity closest to key, but 3719
3738 we don't have the data. then in that case, we should forward the packet
3739 to the next closest peer. */
3740 GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, NULL, 0, 3720 GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, NULL, 0,
3741 get_length, final_get_path, 3721 get_length, final_get_path,
3742 &final_get_path[get_length-2], &my_identity); 3722 &final_get_path[get_length-2], &my_identity);
@@ -3797,7 +3777,7 @@ handle_dht_p2p_get_result (void *cls, const struct GNUNET_PeerIdentity *peer,
3797 GNUNET_break_op (0); 3777 GNUNET_break_op (0);
3798 return GNUNET_YES; 3778 return GNUNET_YES;
3799 } 3779 }
3800 3780
3801 put_path = (const struct GNUNET_PeerIdentity *) &get_result[1]; 3781 put_path = (const struct GNUNET_PeerIdentity *) &get_result[1];
3802 get_path = &put_path[putlen]; 3782 get_path = &put_path[putlen];
3803 payload = (const void *) &get_path[getlen]; 3783 payload = (const void *) &get_path[getlen];
@@ -4492,7 +4472,9 @@ compare_and_update_predecessor (struct GNUNET_PeerIdentity finger,
4492 update_predecessor (finger, trail, trail_length); 4472 update_predecessor (finger, trail, trail_length);
4493 return; 4473 return;
4494 } 4474 }
4495 4475 /* FIXME: Here we should first call find_successor and get a locally known
4476 predecessor. If locally known predecessor is closest then current or finger,
4477 add that as predecessor. */
4496 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&current_predecessor->finger_identity, 4478 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&current_predecessor->finger_identity,
4497 &finger)) 4479 &finger))
4498 { 4480 {
@@ -4729,9 +4711,9 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
4729 4711
4730 /* FIXME: it may fail in case we have done more number of iterations of 4712 /* FIXME: it may fail in case we have done more number of iterations of
4731 find _finger_trail_task. */ 4713 find _finger_trail_task. */
4732 GNUNET_assert (0 == 4714 /*GNUNET_assert (0 ==
4733 GNUNET_CRYPTO_cmp_peer_identity (closest_peer, 4715 GNUNET_CRYPTO_cmp_peer_identity (closest_peer,
4734 &current_successor->finger_identity)); 4716 &current_successor->finger_identity));*/
4735 4717
4736 } 4718 }
4737 4719
@@ -4936,7 +4918,7 @@ handle_dht_p2p_notify_new_successor(void *cls,
4936 return GNUNET_SYSERR; 4918 return GNUNET_SYSERR;
4937 } 4919 }
4938 4920
4939 if ((trail_length-1) == my_index) //FIXMe: SHOULD IT BE TRAIL_LENGTH - 1.s 4921 if ((trail_length-1) == my_index)
4940 next_hop = new_successor; 4922 next_hop = new_successor;
4941 else 4923 else
4942 next_hop = trail[my_index + 1]; 4924 next_hop = trail[my_index + 1];
@@ -5200,7 +5182,6 @@ handle_dht_p2p_trail_teardown (void *cls, const struct GNUNET_PeerIdentity *peer
5200 5182
5201 /* Check if peer is the real peer from which we should get this message.*/ 5183 /* Check if peer is the real peer from which we should get this message.*/
5202 /* Get the prev_hop for this trail by getting the next hop in opposite direction. */ 5184 /* Get the prev_hop for this trail by getting the next hop in opposite direction. */
5203 /* FIXME: is using negation of trail direction correct. */
5204#if 0 5185#if 0
5205 GNUNET_assert (NULL != (prev_hop = 5186 GNUNET_assert (NULL != (prev_hop =
5206 GDS_ROUTING_get_next_hop (trail_id, !trail_direction))); 5187 GDS_ROUTING_get_next_hop (trail_id, !trail_direction)));
@@ -5303,15 +5284,13 @@ handle_dht_p2p_add_trail (void *cls, const struct GNUNET_PeerIdentity *peer,
5303 5284
5304 if ((trail_length - 1) == my_index) 5285 if ((trail_length - 1) == my_index)
5305 { 5286 {
5306
5307 next_hop = destination_peer; 5287 next_hop = destination_peer;
5308 } 5288 }
5309 else 5289 else
5310 { 5290 {
5311 next_hop = trail[my_index + 1]; 5291 next_hop = trail[my_index + 1];
5312 } 5292 }
5313 /* FIXME: check that you always add trail entry even if your finger is 5293
5314 friend. */
5315 /* Add in your routing table. */ 5294 /* Add in your routing table. */
5316 GNUNET_assert (GNUNET_OK == GDS_ROUTING_add (trail_id, next_hop, *peer)); 5295 GNUNET_assert (GNUNET_OK == GDS_ROUTING_add (trail_id, next_hop, *peer));
5317 GNUNET_assert (NULL != 5296 GNUNET_assert (NULL !=
@@ -5321,8 +5300,6 @@ handle_dht_p2p_add_trail (void *cls, const struct GNUNET_PeerIdentity *peer,
5321 trail, trail_length, target_friend); 5300 trail, trail_length, target_friend);
5322 return GNUNET_OK; 5301 return GNUNET_OK;
5323 } 5302 }
5324 /* FIXME: check that you always add trail entry even if your finger is
5325 friend. */
5326 /* I am the destination. Add an entry in routing table. */ 5303 /* I am the destination. Add an entry in routing table. */
5327 GNUNET_assert (GNUNET_OK == GDS_ROUTING_add (trail_id, *peer, my_identity)); 5304 GNUNET_assert (GNUNET_OK == GDS_ROUTING_add (trail_id, *peer, my_identity));
5328 return GNUNET_OK; 5305 return GNUNET_OK;
@@ -5445,7 +5422,6 @@ remove_matching_fingers (const struct GNUNET_PeerIdentity *disconnected_peer)
5445 (next_hop = 5422 (next_hop =
5446 GDS_ROUTING_get_next_hop (trail_id, GDS_ROUTING_SRC_TO_DEST))) 5423 GDS_ROUTING_get_next_hop (trail_id, GDS_ROUTING_SRC_TO_DEST)))
5447 { 5424 {
5448 /* FIXME: This assertion fails check why*/
5449 GNUNET_assert (0 == 5425 GNUNET_assert (0 ==
5450 (GNUNET_CRYPTO_cmp_peer_identity (next_hop, 5426 (GNUNET_CRYPTO_cmp_peer_identity (next_hop,
5451 &remove_finger->finger_identity))); 5427 &remove_finger->finger_identity)));
@@ -5699,4 +5675,4 @@ GDS_NEIGHBOURS_get_my_id (void)
5699 return my_identity; 5675 return my_identity;
5700} 5676}
5701 5677
5702/* end of gnunet-service-xdht_neighbours.c */ 5678/* end of gnunet-service-xdht_neighbours.c */ \ No newline at end of file
diff --git a/src/dht/gnunet-service-xdht_neighbours.h b/src/dht/gnunet-service-xdht_neighbours.h
index 54d5f90f8..8955fadb0 100644
--- a/src/dht/gnunet-service-xdht_neighbours.h
+++ b/src/dht/gnunet-service-xdht_neighbours.h
@@ -161,5 +161,4 @@ GDS_NEIGHBOURS_done (void);
161struct GNUNET_PeerIdentity 161struct GNUNET_PeerIdentity
162GDS_NEIGHBOURS_get_my_id (void); 162GDS_NEIGHBOURS_get_my_id (void);
163 163
164
165#endif 164#endif
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index d72c3875f..62e8acf02 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -661,8 +661,8 @@ main (int argc, char *const *argv)
661 661
662 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 662 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
663 return 2; 663 return 2;
664 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3); /* default delay */ 664 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1); /* default delay */
665 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3); /* default timeout */ 665 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30); /* default timeout */
666 replication = 1; /* default replication */ 666 replication = 1; /* default replication */
667 rc = 0; 667 rc = 0;
668 if (GNUNET_OK != 668 if (GNUNET_OK !=