]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow fr_trunk_request_requeue to work on full connections
authorNick Porter <nick@portercomputing.co.uk>
Thu, 13 Apr 2023 15:54:21 +0000 (16:54 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 4 May 2023 14:27:20 +0000 (15:27 +0100)
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.

src/lib/server/trunk.c
src/lib/server/trunk.h

index a3b913fb508e8b5d877829f5cffbea424f584294..76cf5fc4f1e0e683486af36e18cd108695910657 100644 (file)
@@ -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;
        }
index 8ca9df92f056785c4b342b1559fd339f233a7cb1..3e5b05eb5a8368835acd6c7c062ad704f06a5fb6 100644 (file)
@@ -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.