diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-03-16 08:32:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-03-16 08:32:22 +0000 |
commit | 55ae2c7f6f6332f7530444d33f88c2b47b1b79ef (patch) | |
tree | 7ccb5fac551a227fb0d4f01a54d4d60602f92c4f /src | |
parent | 9bd800e9794c86d5e15f2ddcaa13e5779100bf9d (diff) | |
download | gnunet-55ae2c7f6f6332f7530444d33f88c2b47b1b79ef.tar.gz gnunet-55ae2c7f6f6332f7530444d33f88c2b47b1b79ef.zip |
more stats
Diffstat (limited to 'src')
-rw-r--r-- | src/statistics/gnunet-statistics.c | 2 | ||||
-rw-r--r-- | src/topology/gnunet-daemon-topology.c | 2 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 56 | ||||
-rw-r--r-- | src/transport/transport_api.c | 5 |
4 files changed, 60 insertions, 5 deletions
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index ed0432194..4fc8d8435 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -179,7 +179,7 @@ main (int argc, char *const *argv) | |||
179 | return (GNUNET_OK == | 179 | return (GNUNET_OK == |
180 | GNUNET_PROGRAM_run (argc, | 180 | GNUNET_PROGRAM_run (argc, |
181 | argv, | 181 | argv, |
182 | "gnunet-statistics", | 182 | "gnunet-statistics [options [value]]", |
183 | gettext_noop | 183 | gettext_noop |
184 | ("Print statistics about GNUnet operations."), | 184 | ("Print statistics about GNUnet operations."), |
185 | options, &run, NULL)) ? ret : 1; | 185 | options, &run, NULL)) ? ret : 1; |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index b466dfbbe..789efcd6e 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "gnunet_util_lib.h" | 34 | #include "gnunet_util_lib.h" |
35 | 35 | ||
36 | 36 | ||
37 | #define DEBUG_TOPOLOGY GNUNET_NO | 37 | #define DEBUG_TOPOLOGY GNUNET_YES |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * For how long do we blacklist a peer after a failed connection | 40 | * For how long do we blacklist a peer after a failed connection |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 6f6891002..fb2a45b23 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -2200,7 +2200,7 @@ rerun_validation (void *cls, | |||
2200 | "PING", sizeof (struct TransportPingMessage)); | 2200 | "PING", sizeof (struct TransportPingMessage)); |
2201 | #endif | 2201 | #endif |
2202 | GNUNET_STATISTICS_update (stats, | 2202 | GNUNET_STATISTICS_update (stats, |
2203 | gettext_noop ("# PING messages sent"), | 2203 | gettext_noop ("# PING messages sent for re-validation"), |
2204 | 1, | 2204 | 1, |
2205 | GNUNET_NO); | 2205 | GNUNET_NO); |
2206 | transmit_to_peer (NULL, peer_address, | 2206 | transmit_to_peer (NULL, peer_address, |
@@ -2277,6 +2277,10 @@ run_validation (void *cls, | |||
2277 | uint16_t hello_size; | 2277 | uint16_t hello_size; |
2278 | size_t tsize; | 2278 | size_t tsize; |
2279 | 2279 | ||
2280 | GNUNET_STATISTICS_update (stats, | ||
2281 | gettext_noop ("# peer addresses scheduled for validation"), | ||
2282 | 1, | ||
2283 | GNUNET_NO); | ||
2280 | tp = find_transport (tname); | 2284 | tp = find_transport (tname); |
2281 | if (tp == NULL) | 2285 | if (tp == NULL) |
2282 | { | 2286 | { |
@@ -2285,6 +2289,10 @@ run_validation (void *cls, | |||
2285 | _ | 2289 | _ |
2286 | ("Transport `%s' not loaded, will not try to validate peer address using this transport.\n"), | 2290 | ("Transport `%s' not loaded, will not try to validate peer address using this transport.\n"), |
2287 | tname); | 2291 | tname); |
2292 | GNUNET_STATISTICS_update (stats, | ||
2293 | gettext_noop ("# peer addresses not validated (no applicable transport plugin available)"), | ||
2294 | 1, | ||
2295 | GNUNET_NO); | ||
2288 | return GNUNET_OK; | 2296 | return GNUNET_OK; |
2289 | } | 2297 | } |
2290 | GNUNET_HELLO_get_key (chvc->hello, &pk); | 2298 | GNUNET_HELLO_get_key (chvc->hello, &pk); |
@@ -2312,6 +2320,10 @@ run_validation (void *cls, | |||
2312 | tname, | 2320 | tname, |
2313 | GNUNET_i2s (&id)); | 2321 | GNUNET_i2s (&id)); |
2314 | #endif | 2322 | #endif |
2323 | GNUNET_STATISTICS_update (stats, | ||
2324 | gettext_noop ("# peer addresses not validated (already in progress)"), | ||
2325 | 1, | ||
2326 | GNUNET_NO); | ||
2315 | return GNUNET_OK; | 2327 | return GNUNET_OK; |
2316 | } | 2328 | } |
2317 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen); | 2329 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen); |
@@ -2357,6 +2369,10 @@ run_validation (void *cls, | |||
2357 | "HELLO", hello_size, | 2369 | "HELLO", hello_size, |
2358 | "PING", sizeof (struct TransportPingMessage)); | 2370 | "PING", sizeof (struct TransportPingMessage)); |
2359 | #endif | 2371 | #endif |
2372 | GNUNET_STATISTICS_update (stats, | ||
2373 | gettext_noop ("# PING messages sent for initial validation"), | ||
2374 | 1, | ||
2375 | GNUNET_NO); | ||
2360 | transmit_to_peer (NULL, peer_address, | 2376 | transmit_to_peer (NULL, peer_address, |
2361 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 2377 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
2362 | HELLO_VERIFICATION_TIMEOUT, | 2378 | HELLO_VERIFICATION_TIMEOUT, |
@@ -2460,16 +2476,33 @@ check_hello_validated (void *cls, | |||
2460 | "HELLO", | 2476 | "HELLO", |
2461 | GNUNET_i2s (&target)); | 2477 | GNUNET_i2s (&target)); |
2462 | #endif | 2478 | #endif |
2479 | GNUNET_STATISTICS_update (stats, | ||
2480 | gettext_noop ("# new HELLOs requiring full validation"), | ||
2481 | 1, | ||
2482 | GNUNET_NO); | ||
2463 | GNUNET_HELLO_iterate_addresses (chvc->hello, | 2483 | GNUNET_HELLO_iterate_addresses (chvc->hello, |
2464 | GNUNET_NO, | 2484 | GNUNET_NO, |
2465 | &run_validation, | 2485 | &run_validation, |
2466 | chvc); | 2486 | chvc); |
2467 | } | 2487 | } |
2488 | else | ||
2489 | { | ||
2490 | GNUNET_STATISTICS_update (stats, | ||
2491 | gettext_noop ("# duplicate HELLO (peer known)"), | ||
2492 | 1, | ||
2493 | GNUNET_NO); | ||
2494 | } | ||
2468 | GNUNET_free (chvc); | 2495 | GNUNET_free (chvc); |
2469 | return; | 2496 | return; |
2470 | } | 2497 | } |
2471 | if (h == NULL) | 2498 | if (h == NULL) |
2472 | return; | 2499 | return; |
2500 | #if DEBUG_TRANSPORT | ||
2501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2502 | "Peerinfo had `%s' message for peer `%4s', validating only new addresses.\n", | ||
2503 | "HELLO", | ||
2504 | GNUNET_i2s (peer)); | ||
2505 | #endif | ||
2473 | chvc->hello_known = GNUNET_YES; | 2506 | chvc->hello_known = GNUNET_YES; |
2474 | n = find_neighbour (peer); | 2507 | n = find_neighbour (peer); |
2475 | if (n != NULL) | 2508 | if (n != NULL) |
@@ -2515,7 +2548,10 @@ process_hello (struct TransportPlugin *plugin, | |||
2515 | if (GNUNET_SCHEDULER_get_load (sched, | 2548 | if (GNUNET_SCHEDULER_get_load (sched, |
2516 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD) | 2549 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD) |
2517 | { | 2550 | { |
2518 | /* TODO: call to stats? */ | 2551 | GNUNET_STATISTICS_update (stats, |
2552 | gettext_noop ("# HELLOs ignored due to high load"), | ||
2553 | 1, | ||
2554 | GNUNET_NO); | ||
2519 | return GNUNET_OK; | 2555 | return GNUNET_OK; |
2520 | } | 2556 | } |
2521 | hello = (const struct GNUNET_HELLO_Message *) message; | 2557 | hello = (const struct GNUNET_HELLO_Message *) message; |
@@ -2527,6 +2563,16 @@ process_hello (struct TransportPlugin *plugin, | |||
2527 | GNUNET_CRYPTO_hash (&publicKey, | 2563 | GNUNET_CRYPTO_hash (&publicKey, |
2528 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 2564 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
2529 | &target.hashPubKey); | 2565 | &target.hashPubKey); |
2566 | if (0 == memcmp (&my_identity, | ||
2567 | &target, | ||
2568 | sizeof (struct GNUNET_PeerIdentity))) | ||
2569 | { | ||
2570 | GNUNET_STATISTICS_update (stats, | ||
2571 | gettext_noop ("# HELLOs ignored for validation (is my own HELLO)"), | ||
2572 | 1, | ||
2573 | GNUNET_NO); | ||
2574 | return GNUNET_OK; | ||
2575 | } | ||
2530 | #if DEBUG_TRANSPORT > 1 | 2576 | #if DEBUG_TRANSPORT > 1 |
2531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2577 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2532 | "Processing `%s' message for `%4s' of size %u\n", | 2578 | "Processing `%s' message for `%4s' of size %u\n", |
@@ -2976,6 +3022,10 @@ handle_hello (void *cls, | |||
2976 | { | 3022 | { |
2977 | int ret; | 3023 | int ret; |
2978 | 3024 | ||
3025 | GNUNET_STATISTICS_update (stats, | ||
3026 | gettext_noop ("# HELLOs received from clients"), | ||
3027 | 1, | ||
3028 | GNUNET_NO); | ||
2979 | ret = process_hello (NULL, message); | 3029 | ret = process_hello (NULL, message); |
2980 | GNUNET_SERVER_receive_done (client, ret); | 3030 | GNUNET_SERVER_receive_done (client, ret); |
2981 | } | 3031 | } |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 7889cc715..469bc388c 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -984,6 +984,11 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
984 | struct GNUNET_MessageHeader *hc; | 984 | struct GNUNET_MessageHeader *hc; |
985 | uint16_t size; | 985 | uint16_t size; |
986 | 986 | ||
987 | #if DEBUG_TRANSPORT | ||
988 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
989 | "Offering `%s' message to transport for validation.\n", | ||
990 | "HELLO"); | ||
991 | #endif | ||
987 | GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO); | 992 | GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO); |
988 | size = ntohs (hello->size); | 993 | size = ntohs (hello->size); |
989 | GNUNET_break (size >= sizeof (struct GNUNET_MessageHeader)); | 994 | GNUNET_break (size >= sizeof (struct GNUNET_MessageHeader)); |