summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_validation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-05 00:53:22 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-05 00:53:22 +0000
commit15dd8e6cc1199d611d804853e134882bf13b234a (patch)
tree7cc90886eabe8d0ffa397a319e12a87042d0ba28 /src/transport/gnunet-service-transport_validation.c
parentbf6a2c9deeff7a3b384eb029d8267d6099066df3 (diff)
Various changes:
- removed "in_use" from being passed to ATS, no longer needed as we tell ATS when we cannot follow a suggestion by removing the address; simplifies the code a lot - better handling of state machine, fallback to primary session if address switch to new session timed out - nicer logging - more comments - new testcase failures, because of #3652, #3651 and #3650 (or more that i missed).
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r--src/transport/gnunet-service-transport_validation.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index fb2791eba..746a99f9f 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -450,7 +450,7 @@ cleanup_validation_entry (void *cls,
validations_running,
GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Validation finished, %u validation processes running\n",
+ "Validation aborted, %u validation processes running\n",
validations_running);
}
GNUNET_free (ve);
@@ -830,7 +830,7 @@ add_valid_address (void *cls,
if (GNUNET_YES != ve->known_to_ats)
{
ve->known_to_ats = GNUNET_YES;
- GST_ats_add_address (address, NULL, &ats, 1);
+ GST_ats_add_address (address, &ats, 1);
}
return GNUNET_OK;
}
@@ -1230,6 +1230,35 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
/**
+ * Validate an individual address.
+ *
+ * @param address address we should try to validate
+ */
+void
+GST_validation_handle_address (const struct GNUNET_HELLO_Address *address)
+{
+ struct GNUNET_TRANSPORT_PluginFunctions *papi;
+ struct ValidationEntry *ve;
+
+ papi = GST_plugins_find (address->transport_name);
+ if (NULL == papi)
+ {
+ /* This plugin is currently unvailable ... ignore */
+ return;
+ }
+ ve = find_validation_entry (address);
+ if (NULL == ve->revalidation_task)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Validation process started for fresh address `%s' of %s\n",
+ GST_plugins_a2s (ve->address),
+ GNUNET_i2s (&ve->address->peer));
+ ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
+ }
+}
+
+
+/**
* Iterator callback to go over all addresses and try to validate them
* (unless blocked or already validated).
*
@@ -1243,29 +1272,13 @@ validate_address_iterator (void *cls,
const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
- struct GNUNET_TRANSPORT_PluginFunctions * papi;
- struct ValidationEntry *ve;
-
if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Skipping expired address from HELLO\n");
return GNUNET_OK; /* expired */
}
- papi = GST_plugins_find (address->transport_name);
- if (NULL == papi)
- {
- /* This plugin is currently unvailable ... ignore */
- return GNUNET_OK;
- }
- ve = find_validation_entry (address);
- if (NULL == ve->revalidation_task)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Validation process started for fresh address `%s'\n",
- GST_plugins_a2s (ve->address));
- ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
- }
+ GST_validation_handle_address (address);
return GNUNET_OK;
}
@@ -1457,7 +1470,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
else
{
ve->known_to_ats = GNUNET_YES;
- GST_ats_add_address (ve->address, NULL, ats, 2);
+ GST_ats_add_address (ve->address, ats, 2);
}
}
if (validations_running > 0)