]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
put queued treqs into the array
authorAlan T. DeKok <aland@freeradius.org>
Tue, 7 Apr 2020 19:59:35 +0000 (15:59 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 7 Apr 2020 20:00:33 +0000 (16:00 -0400)
if we signal fail on one packet in the middle of looping over
'i', then 'queued != i'.  So track them separately.

src/modules/rlm_radius/rlm_radius_udp.c

index da72fa7a17e6e6179c1b6b0acc653d0ad6ddbd6e..67716b5b5ecd29cd3a15d1c64ca8f6f46e0ebea8 100644 (file)
@@ -1657,6 +1657,7 @@ static void request_mux(fr_event_list_t *el,
         *      Encode multiple packets in preparation
         *      for transmission with sendmmsg.
         */
+       queued = 0;
        for (i = 0; i < inst->max_send_coalesce; i++) {
                fr_trunk_request_t      *treq;
                udp_request_t           *u;
@@ -1732,9 +1733,9 @@ static void request_mux(fr_event_list_t *el,
                 *      We store the treq so we can place it back in
                 *      the pending state if the sendmmsg call fails.
                 */
-               h->coalesced[i].treq = treq;
-               h->coalesced[i].out.iov_base = u->packet;
-               h->coalesced[i].out.iov_len = u->packet_len;
+               h->coalesced[queued].treq = treq;
+               h->coalesced[queued].out.iov_base = u->packet;
+               h->coalesced[queued].out.iov_len = u->packet_len;
 
                /*
                 *      Tell the trunk API that this request is now in
@@ -1744,8 +1745,8 @@ static void request_mux(fr_event_list_t *el,
                 *      next entry in the heap.
                 */
                fr_trunk_request_signal_sent(treq);
+               queued++;
        }
-       queued = i;
        if (queued == 0) return;        /* No work */
 
        /*