[MINOR] stats: use a dedicated state to output static data
It is a bit expensive and complex to use to call buffer_feed()
directly from the request parser, and there are risks that some
output messages are lost in case of buffer full. Since most of
these messages are static, let's have a state dedicated to print
these messages and store them in a specific area shared with the
stats in the session. This both reduces code size and risks of
losing output data.
diff --git a/include/proto/dumpstats.h b/include/proto/dumpstats.h
index ea579f5..0fe2bbe 100644
--- a/include/proto/dumpstats.h
+++ b/include/proto/dumpstats.h
@@ -46,8 +46,8 @@
#define STAT_CLI_GETREQ 2 /* wait for a request */
#define STAT_CLI_OUTPUT 3 /* all states after this one are responses */
#define STAT_CLI_PROMPT 3 /* display the prompt (first output, same code) */
+#define STAT_CLI_PRINT 4 /* display message in cli->msg */
-#define STAT_CLI_O_HELP 4 /* display help */
#define STAT_CLI_O_INFO 5 /* dump info/stats */
#define STAT_CLI_O_SESS 6 /* dump sessions */
#define STAT_CLI_O_ERR 7 /* dump errors */
diff --git a/include/types/session.h b/include/types/session.h
index 356f0ca..a8734ff 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -212,6 +212,9 @@
int ptr; /* <0: headers, >=0 : text pointer to restart from */
int bol; /* pointer to beginning of current line */
} errors;
+ struct {
+ const char *msg; /* pointer to a persistent message to be returned in PRINT state */
+ } cli;
} data_ctx; /* used by stats I/O handlers to dump the stats */
unsigned int uniq_id; /* unique ID used for the traces */
};