diff options
author | nevans <nevans@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-09-01 13:21:45 +0000 |
---|---|---|
committer | nevans <nevans@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-09-01 13:21:45 +0000 |
commit | 9b6deedc80224ebd17d8e8d13e252c6aa2eb2541 (patch) | |
tree | cbc5e0a81cd722d82c41c8ae65ded2c5be326aa7 /src/dv | |
parent | cca52e47d0605f6bea631bca978db8b2a3dc5da2 (diff) |
klocwork fixes
git-svn-id: https://gnunet.org/svn/gnunet@12797 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 22 | ||||
-rw-r--r-- | src/dv/test_transport_api_dv.c | 4 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 233ea74a5c..cd3a531b7b 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -648,6 +648,11 @@ static struct GNUNET_CONTAINER_Heap *neighbor_min_heap; static struct GNUNET_CONTAINER_Heap *neighbor_max_heap; /** + * Handle for the statistics service. + */ +struct GNUNET_STATISTICS_Handle *stats; + +/** * How far out to keep peers we learn about. */ static unsigned long long fisheye_depth; @@ -2803,12 +2808,19 @@ process_peerinfo (void *cls, } sent = GNUNET_CONTAINER_multihashmap_iterate (extended_neighbors, &add_all_extended_peers, neighbor->send_context); - + if (stats != NULL) + { + GNUNET_STATISTICS_update (stats, "# distant peers gossiped to direct neighbors", sent, GNUNET_NO); + } #if DEBUG_DV_PEER_NUMBERS neighbor_pid = GNUNET_strdup(GNUNET_i2s(&neighbor->identity)); GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped %d extended peers to %s\n", GNUNET_i2s(&my_identity), sent, neighbor_pid); #endif sent = GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors, &add_all_direct_neighbors, neighbor); + if (stats != NULL) + { + GNUNET_STATISTICS_update (stats, "# direct peers gossiped to direct neighbors", sent, GNUNET_NO); + } #if DEBUG_DV_PEER_NUMBERS GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped about %s to %d direct peers\n", GNUNET_i2s(&my_identity), neighbor_pid, sent); GNUNET_free(neighbor_pid); @@ -2875,7 +2887,13 @@ void handle_core_connect (void *cls, { about = GNUNET_CONTAINER_multihashmap_get(extended_neighbors, &peer->hashPubKey); if ((GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL) && (about != NULL)) - sent = GNUNET_CONTAINER_multihashmap_iterate(direct_neighbors, &add_distant_all_direct_neighbors, about); + { + sent = GNUNET_CONTAINER_multihashmap_iterate(direct_neighbors, &add_distant_all_direct_neighbors, about); + if (stats != NULL) + { + GNUNET_STATISTICS_update (stats, "# direct peers gossiped to new direct neighbors", sent, GNUNET_NO); + } + } #if DEBUG_DV GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s: Distance (%d) greater than %d or already know about peer (%s), not re-adding!\n", "dv", distance, DIRECT_NEIGHBOR_COST, GNUNET_i2s(peer)); diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 3e66388fec..2449663007 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c @@ -198,7 +198,6 @@ finish_testing () struct PeerContext *free_peer_pos; struct TestMessageContext *pos; struct TestMessageContext *free_pos; - int count; #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -215,7 +214,6 @@ finish_testing () } all_peers = NULL; - count = 0; pos = test_messages; while (pos != NULL) { @@ -834,6 +832,7 @@ static void all_connect_handler (void *cls, if (second_daemon == NULL) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Couldn't find second peer!\n"); + GNUNET_free(second_shortname); return; } #if !TEST_ALL @@ -1059,6 +1058,7 @@ run (void *cls, main_cfg = cfg; + GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1); peers_left = num_peers; /* Set up a task to end testing if peer start fails */ |