diff options
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index b6b323bd0..ee8a145c1 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -413,7 +413,8 @@ cleanup_validation_entry (void *cls, | |||
413 | ve->valid_until = GNUNET_TIME_UNIT_ZERO_ABS; | 413 | ve->valid_until = GNUNET_TIME_UNIT_ZERO_ABS; |
414 | 414 | ||
415 | /* Notify about deleted entry */ | 415 | /* Notify about deleted entry */ |
416 | validation_entry_changed (ve, GNUNET_TRANSPORT_VS_REMOVE); | 416 | validation_entry_changed (ve, |
417 | GNUNET_TRANSPORT_VS_REMOVE); | ||
417 | 418 | ||
418 | if (NULL != ve->bc) | 419 | if (NULL != ve->bc) |
419 | { | 420 | { |
@@ -449,9 +450,6 @@ cleanup_validation_entry (void *cls, | |||
449 | gettext_noop ("# validations running"), | 450 | gettext_noop ("# validations running"), |
450 | validations_running, | 451 | validations_running, |
451 | GNUNET_NO); | 452 | GNUNET_NO); |
452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
453 | "Validation aborted, %u validation processes running\n", | ||
454 | validations_running); | ||
455 | } | 453 | } |
456 | GNUNET_free (ve); | 454 | GNUNET_free (ve); |
457 | return GNUNET_OK; | 455 | return GNUNET_OK; |
@@ -474,20 +472,30 @@ timeout_hello_validation (void *cls, | |||
474 | struct GNUNET_TIME_Relative left; | 472 | struct GNUNET_TIME_Relative left; |
475 | 473 | ||
476 | ve->timeout_task = NULL; | 474 | ve->timeout_task = NULL; |
475 | /* For valid addresses, we want to wait until the expire; | ||
476 | for addresses under PING validation, we want to wait | ||
477 | until we give up on the PING */ | ||
477 | max = GNUNET_TIME_absolute_max (ve->valid_until, | 478 | max = GNUNET_TIME_absolute_max (ve->valid_until, |
478 | ve->revalidation_block); | 479 | ve->revalidation_block); |
479 | left = GNUNET_TIME_absolute_get_remaining (max); | 480 | left = GNUNET_TIME_absolute_get_remaining (ve->max); |
480 | if (left.rel_value_us > 0) | 481 | if (left.rel_value_us > 0) |
481 | { | 482 | { |
482 | /* should wait a bit longer */ | 483 | /* We should wait a bit longer. This happens when |
484 | address lifetimes are extended due to successful | ||
485 | validations. */ | ||
483 | ve->timeout_task = | 486 | ve->timeout_task = |
484 | GNUNET_SCHEDULER_add_delayed (left, &timeout_hello_validation, ve); | 487 | GNUNET_SCHEDULER_add_delayed (left, |
488 | &timeout_hello_validation, | ||
489 | ve); | ||
485 | return; | 490 | return; |
486 | } | 491 | } |
487 | GNUNET_STATISTICS_update (GST_stats, | 492 | GNUNET_STATISTICS_update (GST_stats, |
488 | gettext_noop ("# address records discarded"), 1, | 493 | gettext_noop ("# address records discarded (timeout)"), |
494 | 1, | ||
489 | GNUNET_NO); | 495 | GNUNET_NO); |
490 | cleanup_validation_entry (NULL, &ve->address->peer, ve); | 496 | cleanup_validation_entry (NULL, |
497 | &ve->address->peer, | ||
498 | ve); | ||
491 | } | 499 | } |
492 | 500 | ||
493 | 501 | ||
@@ -519,11 +527,17 @@ transmit_ping_if_allowed (void *cls, | |||
519 | if (GNUNET_NO == result) | 527 | if (GNUNET_NO == result) |
520 | { | 528 | { |
521 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 529 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
522 | "Blacklist denies to send PING to `%s' `%s' `%s'\n", | 530 | "Blacklist denies sending PING to `%s' `%s' `%s'\n", |
523 | GNUNET_i2s (pid), | 531 | GNUNET_i2s (pid), |
524 | GST_plugins_a2s (ve->address), | 532 | GST_plugins_a2s (ve->address), |
525 | ve->address->transport_name); | 533 | ve->address->transport_name); |
526 | cleanup_validation_entry (NULL, pid, ve); | 534 | GNUNET_STATISTICS_update (GST_stats, |
535 | gettext_noop ("# address records discarded (blacklist)"), | ||
536 | 1, | ||
537 | GNUNET_NO); | ||
538 | cleanup_validation_entry (NULL, | ||
539 | pid, | ||
540 | ve); | ||
527 | return; | 541 | return; |
528 | } | 542 | } |
529 | hello = GST_hello_get (); | 543 | hello = GST_hello_get (); |
@@ -775,8 +789,10 @@ find_validation_entry (const struct GNUNET_HELLO_Address *address) | |||
775 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | 789 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); |
776 | ve->timeout_task = | 790 | ve->timeout_task = |
777 | GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE, | 791 | GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE, |
778 | &timeout_hello_validation, ve); | 792 | &timeout_hello_validation, |
779 | GNUNET_CONTAINER_multipeermap_put (validation_map, &address->peer, | 793 | ve); |
794 | GNUNET_CONTAINER_multipeermap_put (validation_map, | ||
795 | &address->peer, | ||
780 | ve, | 796 | ve, |
781 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 797 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
782 | publish_ve_stat_update (); | 798 | publish_ve_stat_update (); |