From: Alan T. DeKok Date: Thu, 10 Oct 2024 16:19:57 +0000 (-0400) Subject: ensure that the retry struct is always initialized X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94e3c39e80ef539efd67597c178840e079c66735;p=thirdparty%2Ffreeradius-server.git ensure that the retry struct is always initialized before calling the sent() function --- diff --git a/src/lib/bio/retry.c b/src/lib/bio/retry.c index 47621f5efb1..d2f1cbf0d7e 100644 --- a/src/lib/bio/retry.c +++ b/src/lib/bio/retry.c @@ -762,16 +762,20 @@ static ssize_t fr_bio_retry_write(fr_bio_t *bio, void *packet_ctx, void const *b .size = size, }; + /* + * Always initialize the retry timer. That way the sent() callback doesn't have to call + * fr_time(). + * + * The application can call fr_bio_retry_entry_init() to re-initialize it, but that's fine. + */ + fr_retry_init(&item->retry, item->retry.start, &my->retry_config); + /* * Tell the application that we've saved the packet. The "item" pointer allows the application * to cancel this packet if necessary. */ my->sent(bio, packet_ctx, buffer, size, item); - if (!item->retry.config) { - fr_retry_init(&item->retry, item->retry.start, &my->retry_config); - } - /* * This should never fail. */