MEDIUM: proxy: add the global frontend to the list of normal proxies
Since recent changes on the global frontend, it was not possible anymore
to soft-reload a process which had a stats socket because the socket would
not be disabled upon reload. The only solution to this endless madness is
to have the global frontend part of normal proxies.
Since we don't want to get an ID that shifts all other proxies and causes
trouble in deployed environments, we assign it ID #0 which other proxies
can't grab, and we don't report it in the stats pages.
diff --git a/src/dumpstats.c b/src/dumpstats.c
index c8b60a6..0776121 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -160,7 +160,8 @@
return NULL;
init_new_proxy(fe);
-
+ fe->next = proxy;
+ proxy = fe;
fe->last_change = now.tv_sec;
fe->id = strdup("GLOBAL");
fe->cap = PR_CAP_FE;
@@ -169,6 +170,10 @@
fe->conf.file = strdup(file);
fe->conf.line = line;
fe->accept = stats_accept;
+
+ /* the stats frontend is the only one able to assign ID #0 */
+ fe->conf.id.key = fe->uuid = 0;
+ eb32_insert(&used_proxy_id, &fe->conf.id);
return fe;
}
@@ -1709,8 +1714,8 @@
if (si->applet.ctx.stats.flags & STAT_SHOW_STAT) {
while (si->applet.ctx.stats.px) {
px = si->applet.ctx.stats.px;
- /* skip the disabled proxies and non-networked ones */
- if (px->state != PR_STSTOPPED &&
+ /* skip the disabled proxies, global frontend and non-networked ones */
+ if (px->state != PR_STSTOPPED && px->uuid > 0 &&
(px->cap & (PR_CAP_FE | PR_CAP_BE))) {
if (stats_dump_proxy(si, px, NULL) == 0)
return 0;
@@ -2176,8 +2181,8 @@
if (buffer_almost_full(&rep->buf))
return 0;
px = si->applet.ctx.stats.px;
- /* skip the disabled proxies and non-networked ones */
- if (px->state != PR_STSTOPPED && (px->cap & (PR_CAP_FE | PR_CAP_BE)))
+ /* skip the disabled proxies, global frontend and non-networked ones */
+ if (px->state != PR_STSTOPPED && px->uuid > 0 && (px->cap & (PR_CAP_FE | PR_CAP_BE)))
if (stats_dump_proxy(si, px, uri) == 0)
return 0;