diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-02 22:35:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-02 22:35:01 +0000 |
commit | b4921735256da6cb7efbe4b1491ced5beb6b0621 (patch) | |
tree | 61484fe6b5ecf93e2bab7232a05b86020daf0d39 /src/transport/gnunet-service-transport_validation.c | |
parent | 43b1f6976d55ad0abecbf7c4d1f514286550fb3f (diff) | |
download | gnunet-b4921735256da6cb7efbe4b1491ced5beb6b0621.tar.gz gnunet-b4921735256da6cb7efbe4b1491ced5beb6b0621.zip |
add statistic on size of validation_map
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index ab3fbe8f3..37a88ae56 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -332,6 +332,21 @@ struct ValidationEntryMatchContext | |||
332 | 332 | ||
333 | 333 | ||
334 | /** | 334 | /** |
335 | * Provide an update on the `validation_map` map size to statistics. | ||
336 | * This function should be called whenever the `validation_map` | ||
337 | * is changed. | ||
338 | */ | ||
339 | static void | ||
340 | publish_ve_stat_update () | ||
341 | { | ||
342 | GNUNET_STATISTICS_set (GST_stats, | ||
343 | gettext_noop ("# Addresses in validation map"), | ||
344 | GNUNET_CONTAINER_multipeermap_size (validation_map), | ||
345 | GNUNET_NO); | ||
346 | } | ||
347 | |||
348 | |||
349 | /** | ||
335 | * Iterate over validation entries until a matching one is found. | 350 | * Iterate over validation entries until a matching one is found. |
336 | * | 351 | * |
337 | * @param cls the `struct ValidationEntryMatchContext *` | 352 | * @param cls the `struct ValidationEntryMatchContext *` |
@@ -409,6 +424,7 @@ cleanup_validation_entry (void *cls, | |||
409 | GNUNET_CONTAINER_multipeermap_remove (validation_map, | 424 | GNUNET_CONTAINER_multipeermap_remove (validation_map, |
410 | &ve->address->peer, | 425 | &ve->address->peer, |
411 | ve)); | 426 | ve)); |
427 | publish_ve_stat_update (); | ||
412 | if (GNUNET_YES == ve->known_to_ats) | 428 | if (GNUNET_YES == ve->known_to_ats) |
413 | { | 429 | { |
414 | GST_ats_expire_address (ve->address); | 430 | GST_ats_expire_address (ve->address); |
@@ -428,7 +444,7 @@ cleanup_validation_entry (void *cls, | |||
428 | if ( (GNUNET_YES == ve->expecting_pong) && | 444 | if ( (GNUNET_YES == ve->expecting_pong) && |
429 | (validations_running > 0) ) | 445 | (validations_running > 0) ) |
430 | { | 446 | { |
431 | validations_running --; | 447 | validations_running--; |
432 | GNUNET_STATISTICS_set (GST_stats, | 448 | GNUNET_STATISTICS_set (GST_stats, |
433 | gettext_noop ("# validations running"), | 449 | gettext_noop ("# validations running"), |
434 | validations_running, | 450 | validations_running, |
@@ -760,6 +776,7 @@ find_validation_entry (const struct GNUNET_HELLO_Address *address) | |||
760 | GNUNET_CONTAINER_multipeermap_put (validation_map, &address->peer, | 776 | GNUNET_CONTAINER_multipeermap_put (validation_map, &address->peer, |
761 | ve, | 777 | ve, |
762 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 778 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
779 | publish_ve_stat_update (); | ||
763 | validation_entry_changed (ve, GNUNET_TRANSPORT_VS_NEW); | 780 | validation_entry_changed (ve, GNUNET_TRANSPORT_VS_NEW); |
764 | return ve; | 781 | return ve; |
765 | } | 782 | } |
@@ -1433,7 +1450,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1433 | } | 1450 | } |
1434 | if (validations_running > 0) | 1451 | if (validations_running > 0) |
1435 | { | 1452 | { |
1436 | validations_running --; | 1453 | validations_running--; |
1437 | GNUNET_STATISTICS_set (GST_stats, | 1454 | GNUNET_STATISTICS_set (GST_stats, |
1438 | gettext_noop ("# validations running"), | 1455 | gettext_noop ("# validations running"), |
1439 | validations_running, | 1456 | validations_running, |