From d9b68f30f930830b455eea95d0bc619553180136 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 3 Feb 2015 16:11:15 +0000 Subject: add internal API to enable telling ATS about 'failed' suggestions --- .../gnunet-service-transport_validation.c | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'src/transport/gnunet-service-transport_validation.c') diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index f0b8d9466..fb2791eba 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -1519,21 +1519,30 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello) 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, -- cgit v1.2.3