diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-08-21 13:30:37 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-08-21 13:30:37 +0000 |
commit | 54bf1a260ef7fdebee97779b08faf062b1b0f02c (patch) | |
tree | 96553d20c2d4d34b58c46984801adb10318f0fe6 | |
parent | 5ac199dcc8af3a7052086087d36feda38bc4b4de (diff) | |
download | gnunet-54bf1a260ef7fdebee97779b08faf062b1b0f02c.tar.gz gnunet-54bf1a260ef7fdebee97779b08faf062b1b0f02c.zip |
Proper log messages
-rw-r--r-- | src/dht/gnunet-service-xdht_datacache.c | 10 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 36 | ||||
-rw-r--r-- | src/dht/gnunet_dht_profiler.c | 4 |
3 files changed, 26 insertions, 24 deletions
diff --git a/src/dht/gnunet-service-xdht_datacache.c b/src/dht/gnunet-service-xdht_datacache.c index 5f054c730..c66ed7cbe 100644 --- a/src/dht/gnunet-service-xdht_datacache.c +++ b/src/dht/gnunet-service-xdht_datacache.c | |||
@@ -81,7 +81,9 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
81 | GNUNET_STATISTICS_update (GDS_stats, | 81 | GNUNET_STATISTICS_update (GDS_stats, |
82 | gettext_noop ("# ITEMS stored in datacache"), 1, | 82 | gettext_noop ("# ITEMS stored in datacache"), 1, |
83 | GNUNET_NO); | 83 | GNUNET_NO); |
84 | DEBUG("PUT doing put key = %s\n",GNUNET_h2s((key))); | 84 | |
85 | struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id(); | ||
86 | DEBUG("DATACACHE_PUT KEY = %s, peer = %s\n",GNUNET_h2s(key),GNUNET_i2s(&peer)); | ||
85 | r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, | 87 | r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, |
86 | put_path_length, put_path); | 88 | put_path_length, put_path); |
87 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 89 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -335,12 +337,10 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | |||
335 | i++; | 337 | i++; |
336 | } | 338 | } |
337 | } | 339 | } |
338 | 340 | ||
339 | r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, | 341 | r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, |
340 | &ctx); | 342 | &ctx); |
341 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 343 | DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",GNUNET_h2s (key), ctx.eval, r); |
342 | "DATACACHE GET for key %s completed (%d). %u results found.\n", | ||
343 | GNUNET_h2s (key), ctx.eval, r); | ||
344 | return ctx.eval; | 344 | return ctx.eval; |
345 | } | 345 | } |
346 | 346 | ||
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 3f9c8dfd4..0fa70075d 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -2155,10 +2155,10 @@ GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key, | |||
2155 | next_hop = successor.next_hop; | 2155 | next_hop = successor.next_hop; |
2156 | intermediate_trail_id = successor.trail_id; | 2156 | intermediate_trail_id = successor.trail_id; |
2157 | 2157 | ||
2158 | DEBUG("PUT_REQUEST_RECEVIED KEY = %s \n",GNUNET_h2s(key)); | ||
2158 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&best_known_dest, &my_identity)) | 2159 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&best_known_dest, &my_identity)) |
2159 | { | 2160 | { |
2160 | /* I am the destination. */ | 2161 | /* I am the destination. */ |
2161 | DEBUG("PUT destination is me = %s,key =%s\n",GNUNET_i2s(&my_identity),GNUNET_h2s(key)); | ||
2162 | GDS_DATACACHE_handle_put (expiration_time, key, 0, NULL, | 2162 | GDS_DATACACHE_handle_put (expiration_time, key, 0, NULL, |
2163 | block_type,data_size,data); | 2163 | block_type,data_size,data); |
2164 | GDS_CLIENTS_process_put (options, block_type, 0, | 2164 | GDS_CLIENTS_process_put (options, block_type, 0, |
@@ -2297,12 +2297,12 @@ GDS_NEIGHBOURS_handle_get(const struct GNUNET_HashCode *key, | |||
2297 | 2297 | ||
2298 | best_known_dest = successor.best_known_destination; | 2298 | best_known_dest = successor.best_known_destination; |
2299 | intermediate_trail_id = successor.trail_id; | 2299 | intermediate_trail_id = successor.trail_id; |
2300 | 2300 | ||
2301 | DEBUG("GET_REQUEST_RECEVIED KEY = %s \n",GNUNET_h2s(key)); | ||
2301 | /* I am the destination. I have the data. */ | 2302 | /* I am the destination. I have the data. */ |
2302 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, | 2303 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, |
2303 | &best_known_dest)) | 2304 | &best_known_dest)) |
2304 | { | 2305 | { |
2305 | DEBUG("GET destination is me = %s,KEY = %s\n",GNUNET_i2s(&my_identity),GNUNET_h2s(key)); | ||
2306 | GDS_DATACACHE_handle_get (key,block_type, NULL, 0, | 2306 | GDS_DATACACHE_handle_get (key,block_type, NULL, 0, |
2307 | NULL, 0, 1, &my_identity, NULL,&my_identity); | 2307 | NULL, 0, 1, &my_identity, NULL,&my_identity); |
2308 | return; | 2308 | return; |
@@ -2312,8 +2312,8 @@ GDS_NEIGHBOURS_handle_get(const struct GNUNET_HashCode *key, | |||
2312 | across all the fingers. but in current implementation we don't have this case. | 2312 | across all the fingers. but in current implementation we don't have this case. |
2313 | compare finger and current_successor returns, */ | 2313 | compare finger and current_successor returns, */ |
2314 | GDS_NEIGHBOURS_send_get (key, block_type, options, desired_replication_level, | 2314 | GDS_NEIGHBOURS_send_get (key, block_type, options, desired_replication_level, |
2315 | best_known_dest,intermediate_trail_id, &successor.next_hop, | 2315 | best_known_dest,intermediate_trail_id, &successor.next_hop, |
2316 | 0, 1, &my_identity); | 2316 | 0, 1, &my_identity); |
2317 | } | 2317 | } |
2318 | 2318 | ||
2319 | 2319 | ||
@@ -2366,7 +2366,6 @@ GDS_NEIGHBOURS_send_get_result (const struct GNUNET_HashCode *key, | |||
2366 | GNUNET_break(0); | 2366 | GNUNET_break(0); |
2367 | return; | 2367 | return; |
2368 | } | 2368 | } |
2369 | DEBUG("GET RESULT FOR DATA_SIZE = %lu\n",msize); | ||
2370 | current_path_index = 0; | 2369 | current_path_index = 0; |
2371 | if(get_path_length > 0) | 2370 | if(get_path_length > 0) |
2372 | { | 2371 | { |
@@ -2385,6 +2384,7 @@ GDS_NEIGHBOURS_send_get_result (const struct GNUNET_HashCode *key, | |||
2385 | } | 2384 | } |
2386 | if (0 == current_path_index) | 2385 | if (0 == current_path_index) |
2387 | { | 2386 | { |
2387 | DEBUG ("GET_RESULT TO CLIENT KEY = %s, Peer = %s",GNUNET_h2s(key),GNUNET_i2s(&my_identity)); | ||
2388 | GDS_CLIENTS_handle_reply (expiration, key, get_path_length, | 2388 | GDS_CLIENTS_handle_reply (expiration, key, get_path_length, |
2389 | get_path, put_path_length, | 2389 | get_path, put_path_length, |
2390 | put_path, type, data_size, data); | 2390 | put_path, type, data_size, data); |
@@ -3417,6 +3417,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3417 | void *payload; | 3417 | void *payload; |
3418 | size_t msize; | 3418 | size_t msize; |
3419 | uint32_t putlen; | 3419 | uint32_t putlen; |
3420 | uint32_t hop_count; | ||
3420 | size_t payload_size; | 3421 | size_t payload_size; |
3421 | uint64_t key_value; | 3422 | uint64_t key_value; |
3422 | 3423 | ||
@@ -3457,9 +3458,10 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3457 | payload = &put_path[putlen]; | 3458 | payload = &put_path[putlen]; |
3458 | options = ntohl (put->options); | 3459 | options = ntohl (put->options); |
3459 | intermediate_trail_id = put->intermediate_trail_id; | 3460 | intermediate_trail_id = put->intermediate_trail_id; |
3461 | hop_count = ntohl(put->hop_count); | ||
3460 | payload_size = msize - (sizeof (struct PeerPutMessage) + | 3462 | payload_size = msize - (sizeof (struct PeerPutMessage) + |
3461 | putlen * sizeof (struct GNUNET_PeerIdentity)); | 3463 | putlen * sizeof (struct GNUNET_PeerIdentity)); |
3462 | 3464 | hop_count++; | |
3463 | switch (GNUNET_BLOCK_get_key (GDS_block_context, ntohl (put->block_type), | 3465 | switch (GNUNET_BLOCK_get_key (GDS_block_context, ntohl (put->block_type), |
3464 | payload, payload_size, &test_key)) | 3466 | payload, payload_size, &test_key)) |
3465 | { | 3467 | { |
@@ -3570,10 +3572,10 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3570 | } | 3572 | } |
3571 | 3573 | ||
3572 | 3574 | ||
3573 | 3575 | ||
3574 | GDS_CLIENTS_process_put (options, | 3576 | GDS_CLIENTS_process_put (options, |
3575 | ntohl (put->block_type), | 3577 | ntohl (put->block_type), |
3576 | ntohl (put->hop_count), | 3578 | hop_count, |
3577 | ntohl (put->desired_replication_level), | 3579 | ntohl (put->desired_replication_level), |
3578 | putlen, pp, | 3580 | putlen, pp, |
3579 | GNUNET_TIME_absolute_ntoh (put->expiration_time), | 3581 | GNUNET_TIME_absolute_ntoh (put->expiration_time), |
@@ -3584,7 +3586,6 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3584 | /* I am the final destination */ | 3586 | /* I am the final destination */ |
3585 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &best_known_dest)) | 3587 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &best_known_dest)) |
3586 | { | 3588 | { |
3587 | DEBUG("PUT destination is me = %s,KEY = %s\n",GNUNET_i2s(&my_identity),GNUNET_h2s(&(put->key))); | ||
3588 | GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time), | 3589 | GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time), |
3589 | &(put->key),putlen, pp, ntohl (put->block_type), | 3590 | &(put->key),putlen, pp, ntohl (put->block_type), |
3590 | payload_size, payload); | 3591 | payload_size, payload); |
@@ -3595,7 +3596,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3595 | ntohl (put->block_type),ntohl (put->options), | 3596 | ntohl (put->block_type),ntohl (put->options), |
3596 | ntohl (put->desired_replication_level), | 3597 | ntohl (put->desired_replication_level), |
3597 | best_known_dest, intermediate_trail_id, next_hop, | 3598 | best_known_dest, intermediate_trail_id, next_hop, |
3598 | ntohl (put->hop_count), putlen, pp, | 3599 | hop_count, putlen, pp, |
3599 | GNUNET_TIME_absolute_ntoh (put->expiration_time), | 3600 | GNUNET_TIME_absolute_ntoh (put->expiration_time), |
3600 | payload, payload_size); | 3601 | payload, payload_size); |
3601 | } | 3602 | } |
@@ -3625,6 +3626,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3625 | struct GNUNET_PeerIdentity *next_hop; | 3626 | struct GNUNET_PeerIdentity *next_hop; |
3626 | uint32_t get_length; | 3627 | uint32_t get_length; |
3627 | uint64_t key_value; | 3628 | uint64_t key_value; |
3629 | uint32_t hop_count; | ||
3628 | size_t msize; | 3630 | size_t msize; |
3629 | 3631 | ||
3630 | #if ENABLE_MALICIOUS | 3632 | #if ENABLE_MALICIOUS |
@@ -3647,7 +3649,9 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3647 | best_known_dest = get->best_known_destination; | 3649 | best_known_dest = get->best_known_destination; |
3648 | intermediate_trail_id = get->intermediate_trail_id; | 3650 | intermediate_trail_id = get->intermediate_trail_id; |
3649 | get_path = (const struct GNUNET_PeerIdentity *)&get[1]; | 3651 | get_path = (const struct GNUNET_PeerIdentity *)&get[1]; |
3650 | 3652 | hop_count = get->hop_count; | |
3653 | hop_count++; | ||
3654 | |||
3651 | if ((msize < | 3655 | if ((msize < |
3652 | sizeof (struct PeerGetMessage) + | 3656 | sizeof (struct PeerGetMessage) + |
3653 | get_length * sizeof (struct GNUNET_PeerIdentity)) || | 3657 | get_length * sizeof (struct GNUNET_PeerIdentity)) || |
@@ -3657,7 +3661,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3657 | GNUNET_break_op (0); | 3661 | GNUNET_break_op (0); |
3658 | return GNUNET_YES; | 3662 | return GNUNET_YES; |
3659 | } | 3663 | } |
3660 | DEBUG("PUT FOR DATA_SIZE = %lu\n",msize); | 3664 | |
3661 | GNUNET_STATISTICS_update (GDS_stats, | 3665 | GNUNET_STATISTICS_update (GDS_stats, |
3662 | gettext_noop | 3666 | gettext_noop |
3663 | ("# Bytes received from other peers"), msize, | 3667 | ("# Bytes received from other peers"), msize, |
@@ -3682,7 +3686,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3682 | memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity)); | 3686 | memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity)); |
3683 | gp[get_length] = my_identity; | 3687 | gp[get_length] = my_identity; |
3684 | get_length = get_length + 1; | 3688 | get_length = get_length + 1; |
3685 | GDS_CLIENTS_process_get (get->options, get->block_type,get->hop_count, | 3689 | GDS_CLIENTS_process_get (get->options, get->block_type, hop_count, |
3686 | get->desired_replication_level, get->get_path_length, | 3690 | get->desired_replication_level, get->get_path_length, |
3687 | gp, &get->key); | 3691 | gp, &get->key); |
3688 | 3692 | ||
@@ -3721,8 +3725,6 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3721 | /* I am the final destination. */ | 3725 | /* I am the final destination. */ |
3722 | if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &best_known_dest)) | 3726 | if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &best_known_dest)) |
3723 | { | 3727 | { |
3724 | DEBUG("GET destination is me = %s,KEY = %s,get_length = %d\n", | ||
3725 | GNUNET_i2s(&my_identity),GNUNET_h2s(&(get->key)),get_length); | ||
3726 | if (1 == get_length) | 3728 | if (1 == get_length) |
3727 | { | 3729 | { |
3728 | GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, | 3730 | GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, |
@@ -3739,7 +3741,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3739 | { | 3741 | { |
3740 | GDS_NEIGHBOURS_send_get (&(get->key), get->block_type, get->options, | 3742 | GDS_NEIGHBOURS_send_get (&(get->key), get->block_type, get->options, |
3741 | get->desired_replication_level, best_known_dest, | 3743 | get->desired_replication_level, best_known_dest, |
3742 | intermediate_trail_id, next_hop, 0, | 3744 | intermediate_trail_id, next_hop, hop_count, |
3743 | get_length, gp); | 3745 | get_length, gp); |
3744 | } | 3746 | } |
3745 | return GNUNET_YES; | 3747 | return GNUNET_YES; |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index 9fa9f33c4..00ddb61a4 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -588,7 +588,7 @@ delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
588 | } | 588 | } |
589 | get_ac->nrefs++; | 589 | get_ac->nrefs++; |
590 | ac->get_ac = get_ac; | 590 | ac->get_ac = get_ac; |
591 | DEBUG ("Doing a DHT GET for data of size %u\n", get_ac->put_data_size); | 591 | DEBUG ("PUT_REQUEST_START key %s \n", GNUNET_h2s((struct GNUNET_HashCode *)ac->put_data)); |
592 | ac->dht_get = GNUNET_DHT_get_start (ac->dht, | 592 | ac->dht_get = GNUNET_DHT_get_start (ac->dht, |
593 | GNUNET_BLOCK_TYPE_TEST, | 593 | GNUNET_BLOCK_TYPE_TEST, |
594 | &get_ac->hash, | 594 | &get_ac->hash, |
@@ -660,7 +660,7 @@ delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
660 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, | 660 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, |
661 | ac->put_data, ac->put_data_size); | 661 | ac->put_data, ac->put_data_size); |
662 | GNUNET_CRYPTO_hash (ac->put_data, ac->put_data_size, &ac->hash); | 662 | GNUNET_CRYPTO_hash (ac->put_data, ac->put_data_size, &ac->hash); |
663 | DEBUG ("Doing a DHT PUT with data of size %u\n", ac->put_data_size); | 663 | DEBUG ("PUT_REQUEST_START key %s \n", GNUNET_h2s((struct GNUNET_HashCode *)ac->put_data)); |
664 | ac->dht_put = GNUNET_DHT_put (ac->dht, &ac->hash, | 664 | ac->dht_put = GNUNET_DHT_put (ac->dht, &ac->hash, |
665 | replication, | 665 | replication, |
666 | GNUNET_DHT_RO_NONE, | 666 | GNUNET_DHT_RO_NONE, |