mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-11 05:48:41 +00:00
MINOR: flags/stream: use flag dumping for stream error type
The new function is strm_et_show_flags(). Only the error type is handled at the moment, as a bit more complex logic is needed to mix the values and enums present in some fields.
This commit is contained in:
parent
4bab7d81b6
commit
f4cb98ce56
@ -78,28 +78,8 @@ void show_sc_flags(unsigned int f)
|
||||
|
||||
void show_strm_et(unsigned int f)
|
||||
{
|
||||
printf("strm->et = ");
|
||||
if (!f) {
|
||||
printf("STRM_ET_NONE\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SHOW_FLAG(f, STRM_ET_QUEUE_TO);
|
||||
SHOW_FLAG(f, STRM_ET_QUEUE_ERR);
|
||||
SHOW_FLAG(f, STRM_ET_QUEUE_ABRT);
|
||||
SHOW_FLAG(f, STRM_ET_CONN_TO);
|
||||
SHOW_FLAG(f, STRM_ET_CONN_ERR);
|
||||
SHOW_FLAG(f, STRM_ET_CONN_ABRT);
|
||||
SHOW_FLAG(f, STRM_ET_CONN_RES);
|
||||
SHOW_FLAG(f, STRM_ET_CONN_OTHER);
|
||||
SHOW_FLAG(f, STRM_ET_DATA_TO);
|
||||
SHOW_FLAG(f, STRM_ET_DATA_ERR);
|
||||
SHOW_FLAG(f, STRM_ET_DATA_ABRT);
|
||||
|
||||
if (f) {
|
||||
printf("EXTRA(0x%08x)", f);
|
||||
}
|
||||
putchar('\n');
|
||||
strm_et_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("strm->et = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_task_state(unsigned int f)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <haproxy/dynbuf-t.h>
|
||||
#include <haproxy/filters-t.h>
|
||||
#include <haproxy/obj_type-t.h>
|
||||
#include <haproxy/show_flags-t.h>
|
||||
#include <haproxy/stick_table-t.h>
|
||||
#include <haproxy/vars-t.h>
|
||||
|
||||
@ -91,7 +92,9 @@
|
||||
#define PCLI_F_PAYLOAD 0x20000
|
||||
|
||||
|
||||
/* error types reported on the streams for more accurate reporting */
|
||||
/* error types reported on the streams for more accurate reporting.
|
||||
* Please also update the strm_et_show_flags() function below in case of changes.
|
||||
*/
|
||||
enum {
|
||||
STRM_ET_NONE = 0x0000, /* no error yet, leave it to zero */
|
||||
STRM_ET_QUEUE_TO = 0x0001, /* queue timeout */
|
||||
@ -107,6 +110,26 @@ enum {
|
||||
STRM_ET_DATA_ABRT = 0x0400, /* data phase aborted by external cause */
|
||||
};
|
||||
|
||||
/* This function is used to report flags in debugging tools. Please reflect
|
||||
* below any single-bit flag addition above in the same order via the
|
||||
* __APPEND_FLAG macro. The new end of the buffer is returned.
|
||||
*/
|
||||
static forceinline char *strm_et_show_flags(char *buf, size_t len, const char *delim, uint flg)
|
||||
{
|
||||
#define _(f, ...) __APPEND_FLAG(buf, len, delim, flg, f, #f, __VA_ARGS__)
|
||||
/* prologue */
|
||||
_(0);
|
||||
/* flags */
|
||||
_(STRM_ET_QUEUE_TO, _(STRM_ET_QUEUE_ERR, _(STRM_ET_QUEUE_ABRT,
|
||||
_(STRM_ET_CONN_TO, _(STRM_ET_CONN_ERR, _(STRM_ET_CONN_ABRT,
|
||||
_(STRM_ET_CONN_RES, _(STRM_ET_CONN_OTHER, _(STRM_ET_DATA_TO,
|
||||
_(STRM_ET_DATA_ERR, _(STRM_ET_DATA_ABRT)))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
struct hlua;
|
||||
struct proxy;
|
||||
struct pendconn;
|
||||
|
Loading…
Reference in New Issue
Block a user