MINOR: mworker/cli: the mcli_reload bind_conf only send the reload status
Upon a reload with the master CLI, the FD of the master CLI session is
received by the internal socketpair listener.
This session is used to display the status of the reload and then will
close.
diff --git a/include/haproxy/stream-t.h b/include/haproxy/stream-t.h
index 0d4c691..1ec40f5 100644
--- a/include/haproxy/stream-t.h
+++ b/include/haproxy/stream-t.h
@@ -131,6 +131,7 @@
#define PCLI_F_PROMPT 0x10000
#define PCLI_F_PAYLOAD 0x20000
+#define PCLI_F_RELOAD 0x40000 /* this is the "reload" stream, quits after displaying reload status */
/* error types reported on the streams for more accurate reporting.
diff --git a/src/cli.c b/src/cli.c
index 1391345..7d91b2d 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2682,6 +2682,13 @@
if ((s->pcli_flags & ACCESS_LVL_MASK) == ACCESS_LVL_NONE)
s->pcli_flags |= strm_li(s)->bind_conf->level & ACCESS_LVL_MASK;
+ /* stream that comes from the reload listener only responses the reload
+ * status and quits */
+ if (!(s->pcli_flags & PCLI_F_RELOAD)
+ && strm_li(s)->bind_conf == mcli_reload_bind_conf)
+ goto send_status;
+
+
read_again:
/* if the channel is closed for read, we won't receive any more data
from the client, but we don't want to forward this close to the
@@ -2755,6 +2762,13 @@
b_putblk(&req->buf, "help\n", 5);
goto read_again;
+send_status:
+ s->pcli_flags |= PCLI_F_RELOAD;
+ /* dont' use ci_putblk here because SHUTW could have been sent */
+ b_reset(&req->buf);
+ b_putblk(&req->buf, "_loadstatus;quit\n", 17);
+ goto read_again;
+
missing_data:
if (req->flags & CF_SHUTR) {
/* There is no more request or a only a partial one and we