From: Nick Porter Date: Thu, 13 Apr 2023 15:54:21 +0000 (+0100) Subject: Allow fr_trunk_request_requeue to work on full connections X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbbecdfe479412050c1740a6ed77dee399626b9a;p=thirdparty%2Ffreeradius-server.git Allow fr_trunk_request_requeue to work on full connections The request being requeued is part of the list of requests causing the connection to be marked as full - so it should be allowed to requeue. --- diff --git a/src/lib/server/trunk.c b/src/lib/server/trunk.c index a3b913fb508..76cf5fc4f1e 100644 --- a/src/lib/server/trunk.c +++ b/src/lib/server/trunk.c @@ -695,6 +695,7 @@ do { \ #define IN_REQUEST_CANCEL_MUX(_trunk) (((_trunk)->funcs.request_cancel_mux) && ((_trunk)->in_handler == (void *)(_trunk)->funcs.request_cancel_mux)) #define IS_SERVICEABLE(_tconn) ((_tconn)->pub.state & FR_TRUNK_CONN_SERVICEABLE) +#define IS_PROCESSING(_tconn) ((tconn)->pub.state & FR_TRUNK_CONN_PROCESSING) /** Remove the current request from the backlog * @@ -1131,7 +1132,7 @@ static void trunk_request_enter_pending(fr_trunk_request_t *treq, fr_trunk_conne fr_trunk_t *trunk = treq->pub.trunk; fr_assert(tconn->pub.trunk == trunk); - fr_assert(IS_SERVICEABLE(tconn)); + fr_assert(IS_PROCESSING(tconn)); switch (treq->pub.state) { case FR_TRUNK_REQUEST_STATE_INIT: @@ -2570,7 +2571,7 @@ fr_trunk_enqueue_t fr_trunk_request_requeue(fr_trunk_request_t *treq) if (!tconn) return FR_TRUNK_ENQUEUE_FAIL; - if (!IS_SERVICEABLE(tconn)) { + if (!IS_PROCESSING(tconn)) { trunk_request_enter_failed(treq); return FR_TRUNK_ENQUEUE_DST_UNAVAILABLE; } diff --git a/src/lib/server/trunk.h b/src/lib/server/trunk.h index 8ca9df92f05..3e5b05eb5a8 100644 --- a/src/lib/server/trunk.h +++ b/src/lib/server/trunk.h @@ -132,6 +132,19 @@ typedef enum { FR_TRUNK_CONN_DRAINING_TO_FREE \ ) +/** States where the connection may be processing requests + * + */ +#define FR_TRUNK_CONN_PROCESSING \ +(\ + FR_TRUNK_CONN_ACTIVE | \ + FR_TRUNK_CONN_FULL | \ + FR_TRUNK_CONN_INACTIVE | \ + FR_TRUNK_CONN_DRAINING | \ + FR_TRUNK_CONN_INACTIVE_DRAINING | \ + FR_TRUNK_CONN_DRAINING_TO_FREE \ +) + typedef enum { FR_TRUNK_ENQUEUE_IN_BACKLOG = 1, //!< Request should be enqueued in backlog FR_TRUNK_ENQUEUE_OK = 0, //!< Operation was successful.