From 8429097c61690844caacd90ff336be8b8b4f0fd2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 23 Jun 2021 16:33:52 +0200 Subject: [PATCH] MINOR: queue: store a pointer to the queue into the pendconn By following the queue pointer in the pendconn it will now be possible to always retrieve the elements (index, srv, px, etc). --- include/haproxy/queue-t.h | 2 ++ src/queue.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/haproxy/queue-t.h b/include/haproxy/queue-t.h index cb317db31..a2e321c1c 100644 --- a/include/haproxy/queue-t.h +++ b/include/haproxy/queue-t.h @@ -28,11 +28,13 @@ struct proxy; struct server; struct stream; +struct queue; struct pendconn { int strm_flags; /* stream flags */ unsigned int queue_idx; /* value of proxy/server queue_idx at time of enqueue */ struct stream *strm; + struct queue *queue; /* the queue the entry is queued into */ struct proxy *px; struct server *srv; /* the server we are waiting for, may be NULL if don't care */ struct server *target; /* the server that was assigned, = srv except if srv==NULL */ diff --git a/src/queue.c b/src/queue.c index f0dcd117a..f84ec945c 100644 --- a/src/queue.c +++ b/src/queue.c @@ -434,6 +434,7 @@ struct pendconn *pendconn_add(struct stream *strm) max_ptr = &px->be_counters.nbpend_max; } + p->queue = q; p->queue_idx = _HA_ATOMIC_LOAD(&q->idx) - 1; // for logging only new_max = _HA_ATOMIC_ADD_FETCH(&q->length, 1); old_max = _HA_ATOMIC_LOAD(max_ptr);