/*
This file is part of GNUnet.
- (C) 2010-2015 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010-2015 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
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);
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;
}
}
+/**
+ * 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).
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;
}
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)
memcmp (&GST_my_identity,
&pid,
sizeof (struct GNUNET_PeerIdentity)))
+ {
+ /* got our own HELLO, how boring */
return GNUNET_OK;
- /* Add peer identity without addresses to peerinfo service */
- h = GNUNET_HELLO_create (&pid.public_key, NULL, NULL, friend);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Validation received new %s message for peer `%s' with size %u\n"),
- "HELLO",
- GNUNET_i2s (&pid),
- ntohs (hello->size));
- GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Adding `%s' without addresses for peer `%s'\n"), "HELLO",
- GNUNET_i2s (&pid));
+ }
+ if (GNUNET_NO ==
+ GNUNET_CONTAINER_multipeermap_contains (validation_map,
+ &pid))
+ {
+ /* Add peer identity without addresses to peerinfo service */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding HELLO without addresses for peer `%s'\n",
+ GNUNET_i2s (&pid));
+ h = GNUNET_HELLO_create (&pid.public_key, NULL, NULL, friend);
+ GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL);
- GNUNET_free (h);
+ GNUNET_free (h);
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Validation received HELLO message for peer `%s' with size %u, checking for new addresses\n",
+ GNUNET_i2s (&pid),
+ ntohs (hello->size));
+ }
GNUNET_assert (NULL ==
GNUNET_HELLO_iterate_addresses (hm,
GNUNET_NO,