MINOR: h2: implement a basic "show_fd" function

The purpose here is to dump some information regarding an H2 connection,
and a few statistics about its streams. The output looks like this :

     35 : st=0x55(R:PrA W:PrA) ev=0x00(heopi) [lc] cache=0 owner=0x7ff49ee15e80 iocb=0x588a61(conn_fd_handler) tmask=0x1 umask=0x0 cflg=0x00201366 fe=decrypt mux=H2 mux_ctx=0x7ff49ee16f30 st0=2 flg=0x00000002 fctl_cnt=0 send_cnt=33 tree_cnt=33 orph_cnt=0

- st0 is the connection's state (FRAME_H here)
- flg is the connection's flags (MUX_MFULL here)
- fctl_cnt is the number of streams in the fctl_list
- send_cnt is the number of streams in the send_list
- tree_cnt is the number of streams in the streams_by_id tree
- orph_cnt is the number of orphaned streams (cs==0) in the tree
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 03f6e0e..b822caf 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -3327,11 +3327,48 @@
 		/* stream flow control, quit the list */
 		LIST_DEL(&h2s->list);
 		LIST_INIT(&h2s->list);
+
+			if (!h2s->cs && LIST_ISEMPTY(&h2s->h2c->send_list) && LIST_ISEMPTY(&h2s->h2c->fctl_list)) {
+				fprintf(stderr, "%s:%d: removing %p\n", __FUNCTION__, __LINE__, h2s);
+			}
+
 	}
 
 	return total;
 }
 
+/* for debugging with CLI's "show fd" command */
+static void h2_show_fd(struct chunk *msg, struct connection *conn)
+{
+	struct h2c *h2c = conn->mux_ctx;
+	struct h2s *h2s;
+	struct eb32_node *node;
+	int fctl_cnt = 0;
+	int send_cnt = 0;
+	int tree_cnt = 0;
+	int orph_cnt = 0;
+
+	if (!h2c)
+		return;
+
+	list_for_each_entry(h2s, &h2c->fctl_list, list)
+		fctl_cnt++;
+
+	list_for_each_entry(h2s, &h2c->send_list, list)
+		send_cnt++;
+
+	node = eb32_first(&h2c->streams_by_id);
+	while (node) {
+		h2s = container_of(node, struct h2s, by_id);
+		tree_cnt++;
+		if (!h2s->cs)
+			orph_cnt++;
+		node = eb32_next(node);
+	}
+
+	chunk_appendf(msg, " st0=%d flg=0x%08x fctl_cnt=%d send_cnt=%d tree_cnt=%d orph_cnt=%d",
+		      h2c->st0, h2c->flags, fctl_cnt, send_cnt, tree_cnt, orph_cnt);
+}
 
 /*******************************************************/
 /* functions below are dedicated to the config parsers */
@@ -3403,6 +3440,7 @@
 	.detach = h2_detach,
 	.shutr = h2_shutr,
 	.shutw = h2_shutw,
+	.show_fd = h2_show_fd,
 	.flags = MX_FL_CLEAN_ABRT,
 	.name = "H2",
 };