From: Olivier Houchard Date: Thu, 17 Apr 2025 09:20:24 +0000 (+0200) Subject: MINOR: servers: Provide a pointer to the server in srv_per_tgroup. X-Git-Tag: v3.2-dev11~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=444125a7649382332a641881a5614594cd475951;p=thirdparty%2Fhaproxy.git MINOR: servers: Provide a pointer to the server in srv_per_tgroup. Add a pointer to the server into the struct srv_per_tgroup, so that if we only have access to that srv_per_tgroup, we can come back to the corresponding server. --- diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h index dffa2c625..5253cfc72 100644 --- a/include/haproxy/server-t.h +++ b/include/haproxy/server-t.h @@ -274,6 +274,7 @@ struct srv_per_thread { /* Each server will have one occurrence of this structure per thread group */ struct srv_per_tgroup { struct queue queue; /* pending connections */ + struct server *server; /* pointer to the corresponding server */ unsigned int last_other_tgrp_served; /* Last other tgrp we dequeued from */ unsigned int self_served; /* Number of connection we dequeued from our own queue */ unsigned int dequeuing; /* non-zero = dequeuing in progress (atomic) */ diff --git a/src/server.c b/src/server.c index 1e9b2ec84..06c4e9979 100644 --- a/src/server.c +++ b/src/server.c @@ -5805,8 +5805,10 @@ int srv_init_per_thr(struct server *srv) LIST_INIT(&srv->per_thr[i].idle_conn_list); } - for (i = 0; i < global.nbtgroups; i++) + for (i = 0; i < global.nbtgroups; i++) { + srv->per_tgrp[i].server = srv; queue_init(&srv->per_tgrp[i].queue, srv->proxy, srv); + } return 0; }