diff --git a/include/haproxy/stream-t.h b/include/haproxy/stream-t.h index 0d4c691c8..1ec40f513 100644 --- a/include/haproxy/stream-t.h +++ b/include/haproxy/stream-t.h @@ -131,6 +131,7 @@ static forceinline char *strm_show_flags(char *buf, size_t len, const char *deli #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 1391345b3..7d91b2d96 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2682,6 +2682,13 @@ int pcli_wait_for_request(struct stream *s, struct channel *req, int an_bit) 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 @@ send_help: 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