mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-12 10:06:58 +02:00
MINOR: mux-h2: extract the connection dump function out of h2_show_fd()
The function will be reusable to dump connections, so let's extract it.
This commit is contained in:
parent
90bffa2ce3
commit
4e97bcc76b
33
src/mux_h2.c
33
src/mux_h2.c
@ -6773,17 +6773,18 @@ static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for debugging with CLI's "show fd" command */
|
/* appends some info about connection <h2c> to buffer <msg>, or does nothing if
|
||||||
static int h2_show_fd(struct buffer *msg, struct connection *conn)
|
* <h2c> is NULL. Returns non-zero if the connection is considered suspicious.
|
||||||
|
*/
|
||||||
|
static int h2_dump_h2c_info(struct buffer *msg, struct h2c *h2c)
|
||||||
{
|
{
|
||||||
struct h2c *h2c = conn->ctx;
|
const struct buffer *hmbuf, *tmbuf;
|
||||||
struct h2s *h2s = NULL;
|
const struct h2s *h2s = NULL;
|
||||||
struct eb32_node *node;
|
struct eb32_node *node;
|
||||||
int fctl_cnt = 0;
|
int fctl_cnt = 0;
|
||||||
int send_cnt = 0;
|
int send_cnt = 0;
|
||||||
int tree_cnt = 0;
|
int tree_cnt = 0;
|
||||||
int orph_cnt = 0;
|
int orph_cnt = 0;
|
||||||
struct buffer *hmbuf, *tmbuf;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!h2c)
|
if (!h2c)
|
||||||
@ -6795,7 +6796,6 @@ static int h2_show_fd(struct buffer *msg, struct connection *conn)
|
|||||||
list_for_each_entry(h2s, &h2c->send_list, list)
|
list_for_each_entry(h2s, &h2c->send_list, list)
|
||||||
send_cnt++;
|
send_cnt++;
|
||||||
|
|
||||||
h2s = NULL;
|
|
||||||
node = eb32_first(&h2c->streams_by_id);
|
node = eb32_first(&h2c->streams_by_id);
|
||||||
while (node) {
|
while (node) {
|
||||||
h2s = container_of(node, struct h2s, by_id);
|
h2s = container_of(node, struct h2s, by_id);
|
||||||
@ -6823,10 +6823,29 @@ static int h2_show_fd(struct buffer *msg, struct connection *conn)
|
|||||||
(unsigned int)b_data(tmbuf), b_orig(tmbuf),
|
(unsigned int)b_data(tmbuf), b_orig(tmbuf),
|
||||||
(unsigned int)b_head_ofs(tmbuf), (unsigned int)b_size(tmbuf));
|
(unsigned int)b_head_ofs(tmbuf), (unsigned int)b_size(tmbuf));
|
||||||
|
|
||||||
if (h2s) {
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for debugging with CLI's "show fd" command */
|
||||||
|
static int h2_show_fd(struct buffer *msg, struct connection *conn)
|
||||||
|
{
|
||||||
|
struct h2c *h2c = conn->ctx;
|
||||||
|
const struct h2s *h2s;
|
||||||
|
struct eb32_node *node;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!h2c)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret |= h2_dump_h2c_info(msg, h2c);
|
||||||
|
|
||||||
|
node = eb32_last(&h2c->streams_by_id);
|
||||||
|
if (node) {
|
||||||
|
h2s = container_of(node, struct h2s, by_id);
|
||||||
chunk_appendf(msg, " last_h2s=%p", h2s);
|
chunk_appendf(msg, " last_h2s=%p", h2s);
|
||||||
ret |= h2_dump_h2s_info(msg, h2s);
|
ret |= h2_dump_h2s_info(msg, h2s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user