]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
ensure that the retry struct is always initialized
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Oct 2024 16:19:57 +0000 (12:19 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 15 Oct 2024 15:31:12 +0000 (11:31 -0400)
before calling the sent() function

src/lib/bio/retry.c

index 47621f5efb168307aecb218b901f72359efe42c9..d2f1cbf0d7e278803abf0c25db5cd9aa310df47b 100644 (file)
@@ -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.
         */