mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-18 19:45:27 +00:00
MEDIUM: cli: write a prompt for the CLI proxy of the master
Write a prompt with the PID of the target or master. It's always activated for now. Example: 1234> master>
This commit is contained in:
parent
90b1ca1ff5
commit
2f4ce202d7
16
src/cli.c
16
src/cli.c
@ -1620,6 +1620,18 @@ static int cli_parse_simple(char **args, char *payload, struct appctx *appctx, v
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pcli_write_prompt(struct stream *s)
|
||||
{
|
||||
struct buffer *msg = get_trash_chunk();
|
||||
struct channel *oc = si_oc(&s->si[0]);
|
||||
|
||||
if (s->pcli_next_pid == 0)
|
||||
chunk_appendf(msg, "master> ");
|
||||
else
|
||||
chunk_appendf(msg, "%d> ", s->pcli_next_pid);
|
||||
co_inject(oc, msg->area, msg->data);
|
||||
}
|
||||
|
||||
|
||||
/* The pcli_* functions are used for the CLI proxy in the master */
|
||||
|
||||
@ -1880,7 +1892,7 @@ read_again:
|
||||
command for this session */
|
||||
if (target_pid > -1) {
|
||||
s->pcli_next_pid = target_pid;
|
||||
// TODO: pcli_reply the prompt
|
||||
pcli_write_prompt(s);
|
||||
} else {
|
||||
// TODO: pcli_reply() error
|
||||
s->pcli_next_pid = 0;
|
||||
@ -1922,6 +1934,8 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
if ((rep->flags & (CF_SHUTR|CF_READ_NULL))) {
|
||||
/* stream cleanup */
|
||||
|
||||
pcli_write_prompt(s);
|
||||
|
||||
s->si[1].flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
|
||||
si_shutr(&s->si[1]);
|
||||
si_shutw(&s->si[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user