commit bb9229f37d4c4448bbf4cbfbcf4bb3b3b602cc2a
parent e1766e141fa380c1e0b85e2406daa7991f1b3c0a
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Fri, 14 Aug 2026 12:29:48 +0200
transport: do not back off to a day for a peer somebody is waiting for
Diffstat:
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c
@@ -340,6 +340,14 @@
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_DAYS, 1)
/**
+ * What is the slowest rate at which we send challenges to a peer that an
+ * application client explicitly asked for and that we have no confirmed
+ * link to? Somebody is waiting for this one, so a day is not an option.
+ */
+#define WANTED_VALIDATION_CHALLENGE_FREQ \
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
+
+/**
* How soon after an application asked us for a peer do we retry bringing
* the link up for the first time?
*/
@@ -14030,6 +14038,37 @@ validation_transmit_on_queue (struct Queue *q, struct ValidationState *vs)
/**
+ * How slow are we allowed to get with challenges for @a pid?
+ *
+ * An address of a peer nobody is waiting for may back off all the way to
+ * #MAX_VALIDATION_CHALLENGE_FREQ. A peer an application client asked for
+ * and that we have no confirmed link to may not: at a day between
+ * challenges the client would be told about the peer some time next week.
+ *
+ * @param pid peer whose address we are about to challenge
+ * @return the cap for #GNUNET_TIME_randomized_backoff()
+ */
+static struct GNUNET_TIME_Relative
+validation_challenge_freq (const struct GNUNET_PeerIdentity *pid)
+{
+ const struct VirtualLink *vl = lookup_virtual_link (pid);
+
+ if ((NULL != vl) && (GNUNET_YES == vl->confirmed))
+ return MAX_VALIDATION_CHALLENGE_FREQ; /* we have what we want */
+ for (struct TransportClient *tc = clients_head; NULL != tc; tc = tc->next)
+ {
+ if (CT_APPLICATION != tc->type)
+ continue;
+ if (NULL != GNUNET_CONTAINER_multipeermap_get (
+ tc->details.application.requests,
+ pid))
+ return WANTED_VALIDATION_CHALLENGE_FREQ;
+ }
+ return MAX_VALIDATION_CHALLENGE_FREQ;
+}
+
+
+/**
* Task run periodically to validate some address based on #validation_heap.
*
* @param cls NULL
@@ -14095,7 +14134,7 @@ validation_start_cb (void *cls)
/* Finally, reschedule next attempt */
vs->challenge_backoff =
GNUNET_TIME_randomized_backoff (vs->challenge_backoff,
- MAX_VALIDATION_CHALLENGE_FREQ);
+ validation_challenge_freq (&vs->pid));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Address validation task will run again in %s\n",
GNUNET_STRINGS_relative_time_to_string (vs->challenge_backoff,