MINOR: cli: report connection status in "show sess xxx"
Connection flags, targets and transport layers are now reported in
"show sess $PTR", as it is an absolute requirement in debugging.
diff --git a/include/proto/checks.h b/include/proto/checks.h
index 69c5d2a..042b854 100644
--- a/include/proto/checks.h
+++ b/include/proto/checks.h
@@ -32,6 +32,8 @@
int start_checks();
void health_adjust(struct server *s, short status);
+extern struct data_cb check_conn_cb;
+
#endif /* _PROTO_CHECKS_H */
/*
diff --git a/include/proto/session.h b/include/proto/session.h
index a17aa94..463b2e4 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -31,6 +31,8 @@
extern struct pool_head *pool2_session;
extern struct list sessions;
+extern struct data_cb sess_conn_cb;
+
int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr);
/* perform minimal intializations, report 0 in case of error, 1 if OK. */
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 8264506..cd00e5b 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -3478,11 +3478,11 @@
human_time(now.tv_sec - sess->logs.accept_date.tv_sec, 1));
chunk_appendf(&trash,
- " si[0]=%p (state=%d flags=0x%02x fd=%d exp=%s, et=0x%03x)\n",
+ " si[0]=%p (state=%d flags=0x%02x conn=%p exp=%s, et=0x%03x)\n",
&sess->si[0],
sess->si[0].state,
sess->si[0].flags,
- sess->si[0].conn->t.sock.fd,
+ sess->si[0].conn,
sess->si[0].exp ?
tick_is_expired(sess->si[0].exp, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(sess->si[0].exp - now_ms),
@@ -3490,11 +3490,11 @@
sess->si[0].err_type);
chunk_appendf(&trash,
- " si[1]=%p (state=%d flags=0x%02x fd=%d exp=%s, et=0x%03x)\n",
+ " si[1]=%p (state=%d flags=0x%02x conn=%p exp=%s, et=0x%03x)\n",
&sess->si[1],
sess->si[1].state,
sess->si[1].flags,
- sess->si[1].conn->t.sock.fd,
+ sess->si[1].conn,
sess->si[1].exp ?
tick_is_expired(sess->si[1].exp, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(sess->si[1].exp - now_ms),
@@ -3502,6 +3502,48 @@
sess->si[1].err_type);
chunk_appendf(&trash,
+ " lconn=%p (ctrl=%p(%s) xprt=%p(%s) data=%p(%s) fd=%d target=%d flags=0x%08x)\n",
+ sess->si[0].conn,
+ sess->si[0].conn->ctrl,
+ sess->si[0].conn->ctrl ? sess->si[0].conn->ctrl->name : "NONE",
+ sess->si[0].conn->xprt,
+ (sess->si[0].conn->xprt == NULL) ? "NONE" :
+ (sess->si[0].conn->xprt == &raw_sock) ? "RAW" :
+#ifdef USE_OPENSSL
+ (sess->si[0].conn->xprt == &ssl_sock) ? "SSL" :
+#endif
+ "????",
+ sess->si[0].conn->data,
+ (sess->si[0].conn->data == NULL) ? "NONE" :
+ (sess->si[0].conn->data == &sess_conn_cb) ? "SESS" :
+ (sess->si[0].conn->data == &si_conn_cb) ? "STRM" :
+ (sess->si[0].conn->data == &check_conn_cb) ? "CHCK" : "????",
+ sess->si[0].conn->t.sock.fd,
+ sess->si[0].conn->target ? *sess->si[0].conn->target : 0,
+ sess->si[0].conn->flags);
+
+ chunk_appendf(&trash,
+ " rconn=%p (ctrl=%p(%s) xprt=%p(%s) data=%p(%s) fd=%d target=%d flags=0x%08x)\n",
+ sess->si[1].conn,
+ sess->si[1].conn->ctrl,
+ sess->si[1].conn->ctrl ? sess->si[1].conn->ctrl->name : "NONE",
+ sess->si[1].conn->xprt,
+ (sess->si[1].conn->xprt == NULL) ? "NONE" :
+ (sess->si[1].conn->xprt == &raw_sock) ? "RAW" :
+#ifdef USE_OPENSSL
+ (sess->si[1].conn->xprt == &ssl_sock) ? "SSL" :
+#endif
+ "UNKNOWN",
+ sess->si[1].conn->data,
+ (sess->si[1].conn->data == NULL) ? "NONE" :
+ (sess->si[1].conn->data == &sess_conn_cb) ? "SESS" :
+ (sess->si[1].conn->data == &si_conn_cb) ? "STRM" :
+ (sess->si[1].conn->data == &check_conn_cb) ? "CHCK" : "????",
+ sess->si[1].conn->t.sock.fd,
+ sess->si[1].conn->target ? *sess->si[1].conn->target : 0,
+ sess->si[1].conn->flags);
+
+ chunk_appendf(&trash,
" txn=%p (flags=0x%x meth=%d status=%d req.st=%d rsp.st=%d)\n",
&sess->txn, sess->txn.flags, sess->txn.meth, sess->txn.status,
sess->txn.req.msg_state, sess->txn.rsp.msg_state);