haproxy/backport-BUG-MEDIUM-queue-Make-process_srv_queue-return-the-n.patch
2025-03-17 08:08:21 +00:00

92 lines
3.4 KiB
Diff

From a4f2e1a58442b03a227859c1c48c0ad495c03541 Mon Sep 17 00:00:00 2001
From: Olivier Houchard <ohouchard@haproxy.com>
Date: Mon, 23 Dec 2024 14:17:25 +0000
Subject: [PATCH] BUG/MEDIUM: queue: Make process_srv_queue return the number
of streams
Make process_srv_queue() return the number of streams unqueued, as
pendconn_grab_from_px() did, as that number is used by
srv_update_status() to generate logs.
This should be backported up to 2.6 with
111ea83ed4e13ac3ab028ed5e95201a1b4aa82b8
(cherry picked from commit 5b8899b6ccc7dab3a54a51dcb8ba1512bd0c886c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 70588a16903002709cf3c84255ad8ded73f8e584)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 365378bfdf283650ce1ac152348ca59b6d4c32c1)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 4fb445fe5769172354d08f4a726f99e9815494c1)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 2f50a4aad1181ff03aaa561fe0c501ce4f6e261a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
Conflict:NA
Reference:https://git.haproxy.org/?p=haproxy-2.6.git;a=patch;h=a4f2e1a58442b03a227859c1c48c0ad495c03541
---
include/haproxy/queue.h | 2 +-
src/queue.c | 3 ++-
src/server.c | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/haproxy/queue.h b/include/haproxy/queue.h
index 702a978..28ca897 100644
--- a/include/haproxy/queue.h
+++ b/include/haproxy/queue.h
@@ -34,7 +34,7 @@ extern struct pool_head *pool_head_pendconn;
struct pendconn *pendconn_add(struct stream *strm);
int pendconn_dequeue(struct stream *strm);
-void process_srv_queue(struct server *s);
+int process_srv_queue(struct server *s);
unsigned int srv_dynamic_maxconn(const struct server *s);
int pendconn_redistribute(struct server *s);
int pendconn_grab_from_px(struct server *s);
diff --git a/src/queue.c b/src/queue.c
index 1d3bcbb..0230578 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -354,7 +354,7 @@ static int pendconn_process_next_strm(struct server *srv, struct proxy *px, int
/* Manages a server's connection queue. This function will try to dequeue as
* many pending streams as possible, and wake them up.
*/
-void process_srv_queue(struct server *s)
+int process_srv_queue(struct server *s)
{
struct server *ref = s->track ? s->track : s;
struct proxy *p = s->proxy;
@@ -413,6 +413,7 @@ void process_srv_queue(struct server *s)
if (p->lbprm.server_take_conn)
p->lbprm.server_take_conn(s);
}
+ return done;
}
/* Adds the stream <strm> to the pending connection queue of server <strm>->srv
diff --git a/src/server.c b/src/server.c
index 60bbbf0..dbda1a6 100644
--- a/src/server.c
+++ b/src/server.c
@@ -5357,7 +5357,7 @@ static void srv_update_status(struct server *s)
/* check if we can handle some connections queued.
* We will take as many as we can handle.
*/
- process_srv_queue(s);
+ xferred = process_srv_queue(s);
tmptrash = alloc_trash_chunk();
if (tmptrash) {
@@ -5561,7 +5561,7 @@ static void srv_update_status(struct server *s)
/* check if we can handle some connections queued.
* We will take as many as we can handle.
*/
- process_srv_queue(s);
+ xferred = process_srv_queue(s);
}
else if (s->next_admin & SRV_ADMF_MAINT) {
/* remaining in maintenance mode, let's inform precisely about the
--
1.7.10.4