aboutsummaryrefslogtreecommitdiff
path: root/src/dv/gnunet-service-dv.c
diff options
context:
space:
mode:
authornevans <nevans@140774ce-b5e7-0310-ab8b-a85725594a96>2010-09-01 13:21:45 +0000
committernevans <nevans@140774ce-b5e7-0310-ab8b-a85725594a96>2010-09-01 13:21:45 +0000
commit9b6deedc80224ebd17d8e8d13e252c6aa2eb2541 (patch)
treecbc5e0a81cd722d82c41c8ae65ded2c5be326aa7 /src/dv/gnunet-service-dv.c
parentcca52e47d0605f6bea631bca978db8b2a3dc5da2 (diff)
klocwork fixes
git-svn-id: https://gnunet.org/svn/gnunet@12797 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/dv/gnunet-service-dv.c')
-rw-r--r--src/dv/gnunet-service-dv.c22
1 files changed, 20 insertions, 2 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));