commit d5dcc04417769741800e079a4f6768d95592a30a
parent df99b3b630e9a3ba54c7a662f69eef949d8e3ba5
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Tue, 4 Aug 2026 17:57:06 +0200
transport: fix peerstore HELLO refresh logic
Diffstat:
1 file changed, 37 insertions(+), 15 deletions(-)
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c
@@ -6718,7 +6718,21 @@ pils_sign_address (
my_identity = GNUNET_PILS_get_identity (pils);
if ((NULL == my_identity) ||
(GNUNET_OK != sign_by_my_identity (&sa.purpose, &sig)))
- return; /* #store_pi() will try again */
+ {
+ /* Nothing else re-arms @e st: #store_pi() cleared it before calling us,
+ and the only other thing that sets it is #peerstore_store_own_cb(),
+ which is on the far side of the store we just failed to start. So a
+ single failure to sign used to end the refresh cycle for this address
+ for the rest of the process' life. */
+ if (NULL == ale->st)
+ {
+ ale->pils_backoff = GNUNET_TIME_STD_BACKOFF (ale->pils_backoff);
+ ale->st = GNUNET_SCHEDULER_add_delayed (ale->pils_backoff,
+ &store_pi,
+ ale);
+ }
+ return;
+ }
pc = GNUNET_new (struct PilsAddressSignContext);
pc->ale = ale;
pc->et = mono_time;
@@ -6773,23 +6787,31 @@ store_pi (void *cls)
GNUNET_STRINGS_absolute_time_to_string (hello_mono_time));
add_success = GNUNET_HELLO_builder_add_address (GST_my_hello,
address_uri);
- if (GNUNET_OK != add_success)
+ /* NOTE: #GNUNET_HELLO_builder_add_address() answers GNUNET_NO for an
+ address that is already in the builder, and on every call after the
+ first one for a given address that is exactly what happens: nothing
+ ever removes an address from @a GST_my_hello except
+ #handle_del_address(). This function is the *refresh* cycle --
+ #peerstore_store_own_cb() re-arms it at a quarter of the address'
+ expiration -- so bailing out on GNUNET_NO here stopped the refresh
+ after precisely one round. Our own HELLO then expired
+ (#GNUNET_HELLO_ADDRESS_EXPIRATION, twelve hours) and was never
+ renewed: peers can no longer learn how to reach us, and a link that
+ drops after that never comes back. Only GNUNET_SYSERR -- a malformed
+ URI, which retrying cannot fix -- is a reason not to store. */
+ if (GNUNET_SYSERR == add_success)
{
- GNUNET_log ((GNUNET_NO == add_success) ?
- GNUNET_ERROR_TYPE_DEBUG : GNUNET_ERROR_TYPE_WARNING,
- "Storing our address `%s' %s\n",
- address_uri,
- GNUNET_NO == add_success ? "not done" : "failed");
- GNUNET_free (address_uri);
- return;
- }
- else
- {
-
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Storing our address `%s'\n",
+ "Not storing our address `%s': not a valid HELLO URI\n",
address_uri);
+ GNUNET_free (address_uri);
+ return;
}
+ GNUNET_log ((GNUNET_NO == add_success) ?
+ GNUNET_ERROR_TYPE_DEBUG : GNUNET_ERROR_TYPE_INFO,
+ "%s our address `%s' in PEERSTORE\n",
+ (GNUNET_NO == add_success) ? "Refreshing" : "Storing",
+ address_uri);
// FIXME hello_mono_time used here?? What about expiration in ale?
pils_sign_address (ale,
hello_mono_time);
@@ -12203,7 +12225,7 @@ update_pm_next_attempt (struct PendingMessage *pm,
", reorder root! Next attempt is %" PRIu64 "\n",
root->logging_uuid,
root->next_attempt.abs_value_us);
- //if (PMT_DV_BOX == root->pmt)
+ // if (PMT_DV_BOX == root->pmt)
// root = root->frag_parent;
reorder_root_pm (root, root->next_attempt);
// root->next_attempt = GNUNET_TIME_UNIT_ZERO_ABS;