@@ -725,7 +725,7 @@ do { \
725725#define IN_REQUEST_CANCEL_MUX (_trunk ) (((_trunk)->funcs.request_cancel_mux) && ((_trunk)->in_handler == (void *)(_trunk)->funcs.request_cancel_mux))
726726
727727#define IS_SERVICEABLE (_tconn ) ((_tconn)->pub.state & TRUNK_CONN_SERVICEABLE)
728- #define IS_PROCESSING (_tconn ) ((tconn )->pub.state & TRUNK_CONN_PROCESSING)
728+ #define IS_PROCESSING (_tconn ) ((_tconn )->pub.state & TRUNK_CONN_PROCESSING)
729729
730730/** Remove the current request from the backlog
731731 *
@@ -1342,7 +1342,7 @@ static void trunk_request_enter_reapable(trunk_request_t *treq)
13421342 break ;
13431343
13441344 default :
1345- REQUEST_BAD_STATE_TRANSITION (TRUNK_REQUEST_STATE_SENT );
1345+ REQUEST_BAD_STATE_TRANSITION (TRUNK_REQUEST_STATE_REAPABLE );
13461346 }
13471347
13481348 REQUEST_STATE_TRANSITION (TRUNK_REQUEST_STATE_REAPABLE );
@@ -1458,7 +1458,7 @@ static void trunk_request_enter_cancel_partial(trunk_request_t *treq)
14581458 }
14591459
14601460 REQUEST_STATE_TRANSITION (TRUNK_REQUEST_STATE_CANCEL_PARTIAL );
1461- fr_assert (!tconn -> partial );
1461+ fr_assert (!tconn -> cancel_partial );
14621462 tconn -> cancel_partial = treq ;
14631463}
14641464
@@ -2340,10 +2340,12 @@ void trunk_request_signal_cancel_complete(trunk_request_t *treq)
23402340void trunk_request_free (trunk_request_t * * treq_to_free )
23412341{
23422342 trunk_request_t * treq = * treq_to_free ;
2343- trunk_t * trunk = treq -> pub . trunk ;
2343+ trunk_t * trunk ;
23442344
23452345 if (unlikely (!treq )) return ;
23462346
2347+ trunk = treq -> pub .trunk ;
2348+
23472349 /*
23482350 * The only valid states a trunk request can be
23492351 * freed from.
@@ -2630,7 +2632,7 @@ trunk_enqueue_t trunk_request_enqueue(trunk_request_t **treq_out, trunk_t *trunk
26302632 treq = * treq_out ;
26312633 } else {
26322634 * treq_out = treq = trunk_request_alloc (trunk , request );
2633- if (!treq ) return TRUNK_ENQUEUE_FAIL ;
2635+ if (!treq ) return TRUNK_ENQUEUE_NO_CAPACITY ;
26342636 }
26352637 treq -> pub .preq = preq ;
26362638 treq -> pub .rctx = rctx ;
@@ -2649,7 +2651,7 @@ trunk_enqueue_t trunk_request_enqueue(trunk_request_t **treq_out, trunk_t *trunk
26492651 treq = * treq_out ;
26502652 } else {
26512653 * treq_out = treq = trunk_request_alloc (trunk , request );
2652- if (!treq ) return TRUNK_ENQUEUE_FAIL ;
2654+ if (!treq ) return TRUNK_ENQUEUE_NO_CAPACITY ;
26532655 }
26542656 treq -> pub .preq = preq ;
26552657 treq -> pub .rctx = rctx ;
@@ -2782,7 +2784,8 @@ trunk_enqueue_t trunk_request_enqueue_on_conn(trunk_request_t **treq_out, trunk_
27822784 if (* treq_out ) {
27832785 treq = * treq_out ;
27842786 } else {
2785- MEM (* treq_out = treq = trunk_request_alloc (trunk , request ));
2787+ * treq_out = treq = trunk_request_alloc (trunk , request );
2788+ if (!treq ) return TRUNK_ENQUEUE_NO_CAPACITY ;
27862789 }
27872790
27882791 treq -> pub .preq = preq ;
@@ -4241,7 +4244,9 @@ static void trunk_manage(trunk_t *trunk, fr_time_t now)
42414244 * Process deferred connection freeing
42424245 */
42434246 if (!trunk -> in_handler ) {
4244- while ((tconn = fr_dlist_head (& trunk -> to_free ))) talloc_free (fr_dlist_remove (& trunk -> to_free , tconn ));
4247+ while ((tconn = fr_dlist_pop_head (& trunk -> to_free )) != NULL ) {
4248+ talloc_free (tconn );
4249+ }
42454250 }
42464251
42474252 /*
0 commit comments