From: Arran Cudbard-Bell Date: Wed, 11 Dec 2019 02:38:44 +0000 (+0700) Subject: Move to macros for all request list changes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcbd3acc3d21482857d451b69ace290f11154050;p=thirdparty%2Ffreeradius-server.git Move to macros for all request list changes --- diff --git a/src/lib/server/trunk.c b/src/lib/server/trunk.c index e1c08523425..1297469da68 100644 --- a/src/lib/server/trunk.c +++ b/src/lib/server/trunk.c @@ -609,6 +609,15 @@ do { \ tconn->partial = NULL; \ } while (0) +/** Remove the current request from the sent list + * + */ +#define REQUEST_EXTRACT_SENT(_treq) fr_dlist_remove(&tconn->sent, treq); + +/** Remove the current request from the cancel list + * + */ +#define REQUEST_EXTRACT_CANCEL(_treq) fr_dlist_remove(&tconn->cancel, treq); /** Remove the current request from the cancel_partial slot * @@ -619,6 +628,10 @@ do { \ tconn->cancel_partial = NULL; \ } while (0) +/** Remove the current request from the cancel sent list + * + */ +#define REQUEST_EXTRACT_CANCEL_SENT(_treq) fr_dlist_remove(&tconn->cancel_sent, treq); /** Reorder the connections in the active heap * @@ -696,11 +709,11 @@ static void trunk_request_remove_from_conn(fr_trunk_request_t *treq) break; case FR_TRUNK_REQUEST_SENT: - fr_dlist_remove(&tconn->sent, treq); + REQUEST_EXTRACT_SENT(treq); break; case FR_TRUNK_REQUEST_CANCEL: - fr_dlist_remove(&tconn->cancel, treq); + REQUEST_EXTRACT_CANCEL(treq); break; case FR_TRUNK_REQUEST_CANCEL_PARTIAL: @@ -708,7 +721,7 @@ static void trunk_request_remove_from_conn(fr_trunk_request_t *treq) break; case FR_TRUNK_REQUEST_CANCEL_SENT: - fr_dlist_remove(&tconn->cancel_sent, treq); + REQUEST_EXTRACT_CANCEL_SENT(treq); break; default: @@ -789,7 +802,7 @@ static void trunk_request_enter_backlog(fr_trunk_request_t *treq) break; case FR_TRUNK_REQUEST_CANCEL: - fr_dlist_remove(&tconn->cancel, treq); + REQUEST_EXTRACT_CANCEL(treq); break; default: @@ -848,7 +861,7 @@ static void trunk_request_enter_pending(fr_trunk_request_t *treq, fr_trunk_conne break; case FR_TRUNK_REQUEST_CANCEL: /* Moved from another connection */ - fr_dlist_remove(&tconn->cancel, treq); + REQUEST_EXTRACT_CANCEL(treq); break; default: @@ -989,7 +1002,7 @@ static void trunk_request_enter_cancel(fr_trunk_request_t *treq, fr_trunk_cancel break; case FR_TRUNK_REQUEST_SENT: - fr_dlist_remove(&tconn->sent, treq); + REQUEST_EXTRACT_SENT(treq); break; default: @@ -1034,7 +1047,7 @@ static void trunk_request_enter_cancel_partial(fr_trunk_request_t *treq) switch (treq->state) { case FR_TRUNK_REQUEST_CANCEL: /* The only valid state cancel_sent can be reached from */ - fr_dlist_remove(&tconn->cancel, treq); + REQUEST_EXTRACT_CANCEL(treq); break; default: @@ -1069,7 +1082,7 @@ static void trunk_request_enter_cancel_sent(fr_trunk_request_t *treq) break; case FR_TRUNK_REQUEST_CANCEL: - fr_dlist_remove(&tconn->cancel, treq); + REQUEST_EXTRACT_CANCEL(treq); break; default: @@ -1104,7 +1117,7 @@ static void trunk_request_enter_cancel_complete(fr_trunk_request_t *treq) switch (treq->state) { case FR_TRUNK_REQUEST_CANCEL_SENT: - fr_dlist_remove(&tconn->cancel_sent, treq); + REQUEST_EXTRACT_CANCEL_SENT(treq); break; default: