diff options
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 56 |
1 files changed, 53 insertions, 3 deletions
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 | } |