aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-09-01 13:21:45 +0000
committerNathan S. Evans <evans@in.tum.de>2010-09-01 13:21:45 +0000
commitc09f6eb6d32f57778cf8f8baf0456cbe7158eb79 (patch)
treecbc5e0a81cd722d82c41c8ae65ded2c5be326aa7
parent930871b49ea5ba14a92c6c0ed8e3ecc648da0b22 (diff)
downloadgnunet-c09f6eb6d32f57778cf8f8baf0456cbe7158eb79.tar.gz
gnunet-c09f6eb6d32f57778cf8f8baf0456cbe7158eb79.zip
klocwork fixes
-rw-r--r--src/dv/gnunet-service-dv.c22
-rw-r--r--src/dv/test_transport_api_dv.c4
2 files changed, 22 insertions, 4 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index 233ea74a5..cd3a531b7 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;
648static struct GNUNET_CONTAINER_Heap *neighbor_max_heap; 648static struct GNUNET_CONTAINER_Heap *neighbor_max_heap;
649 649
650/** 650/**
651 * Handle for the statistics service.
652 */
653struct GNUNET_STATISTICS_Handle *stats;
654
655/**
651 * How far out to keep peers we learn about. 656 * How far out to keep peers we learn about.
652 */ 657 */
653static unsigned long long fisheye_depth; 658static unsigned long long fisheye_depth;
@@ -2803,12 +2808,19 @@ process_peerinfo (void *cls,
2803 } 2808 }
2804 2809
2805 sent = GNUNET_CONTAINER_multihashmap_iterate (extended_neighbors, &add_all_extended_peers, neighbor->send_context); 2810 sent = GNUNET_CONTAINER_multihashmap_iterate (extended_neighbors, &add_all_extended_peers, neighbor->send_context);
2806 2811 if (stats != NULL)
2812 {
2813 GNUNET_STATISTICS_update (stats, "# distant peers gossiped to direct neighbors", sent, GNUNET_NO);
2814 }
2807#if DEBUG_DV_PEER_NUMBERS 2815#if DEBUG_DV_PEER_NUMBERS
2808 neighbor_pid = GNUNET_strdup(GNUNET_i2s(&neighbor->identity)); 2816 neighbor_pid = GNUNET_strdup(GNUNET_i2s(&neighbor->identity));
2809 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped %d extended peers to %s\n", GNUNET_i2s(&my_identity), sent, neighbor_pid); 2817 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped %d extended peers to %s\n", GNUNET_i2s(&my_identity), sent, neighbor_pid);
2810#endif 2818#endif
2811 sent = GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors, &add_all_direct_neighbors, neighbor); 2819 sent = GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors, &add_all_direct_neighbors, neighbor);
2820 if (stats != NULL)
2821 {
2822 GNUNET_STATISTICS_update (stats, "# direct peers gossiped to direct neighbors", sent, GNUNET_NO);
2823 }
2812#if DEBUG_DV_PEER_NUMBERS 2824#if DEBUG_DV_PEER_NUMBERS
2813 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped about %s to %d direct peers\n", GNUNET_i2s(&my_identity), neighbor_pid, sent); 2825 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped about %s to %d direct peers\n", GNUNET_i2s(&my_identity), neighbor_pid, sent);
2814 GNUNET_free(neighbor_pid); 2826 GNUNET_free(neighbor_pid);
@@ -2875,7 +2887,13 @@ void handle_core_connect (void *cls,
2875 { 2887 {
2876 about = GNUNET_CONTAINER_multihashmap_get(extended_neighbors, &peer->hashPubKey); 2888 about = GNUNET_CONTAINER_multihashmap_get(extended_neighbors, &peer->hashPubKey);
2877 if ((GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL) && (about != NULL)) 2889 if ((GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL) && (about != NULL))
2878 sent = GNUNET_CONTAINER_multihashmap_iterate(direct_neighbors, &add_distant_all_direct_neighbors, about); 2890 {
2891 sent = GNUNET_CONTAINER_multihashmap_iterate(direct_neighbors, &add_distant_all_direct_neighbors, about);
2892 if (stats != NULL)
2893 {
2894 GNUNET_STATISTICS_update (stats, "# direct peers gossiped to new direct neighbors", sent, GNUNET_NO);
2895 }
2896 }
2879#if DEBUG_DV 2897#if DEBUG_DV
2880 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2898 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2881 "%s: Distance (%d) greater than %d or already know about peer (%s), not re-adding!\n", "dv", distance, DIRECT_NEIGHBOR_COST, GNUNET_i2s(peer)); 2899 "%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 3e66388fe..244966300 100644
--- a/src/dv/test_transport_api_dv.c
+++ b/src/dv/test_transport_api_dv.c
@@ -198,7 +198,6 @@ finish_testing ()
198 struct PeerContext *free_peer_pos; 198 struct PeerContext *free_peer_pos;
199 struct TestMessageContext *pos; 199 struct TestMessageContext *pos;
200 struct TestMessageContext *free_pos; 200 struct TestMessageContext *free_pos;
201 int count;
202 201
203#if VERBOSE 202#if VERBOSE
204 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -215,7 +214,6 @@ finish_testing ()
215 } 214 }
216 all_peers = NULL; 215 all_peers = NULL;
217 216
218 count = 0;
219 pos = test_messages; 217 pos = test_messages;
220 while (pos != NULL) 218 while (pos != NULL)
221 { 219 {
@@ -834,6 +832,7 @@ static void all_connect_handler (void *cls,
834 if (second_daemon == NULL) 832 if (second_daemon == NULL)
835 { 833 {
836 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Couldn't find second peer!\n"); 834 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Couldn't find second peer!\n");
835 GNUNET_free(second_shortname);
837 return; 836 return;
838 } 837 }
839#if !TEST_ALL 838#if !TEST_ALL
@@ -1059,6 +1058,7 @@ run (void *cls,
1059 1058
1060 main_cfg = cfg; 1059 main_cfg = cfg;
1061 1060
1061 GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1);
1062 peers_left = num_peers; 1062 peers_left = num_peers;
1063 1063
1064 /* Set up a task to end testing if peer start fails */ 1064 /* Set up a task to end testing if peer start fails */