]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cli: report connection status in "show sess xxx"
authorWilly Tarreau <w@1wt.eu>
Mon, 19 Nov 2012 15:10:32 +0000 (16:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Nov 2012 15:22:22 +0000 (16:22 +0100)
Connection flags, targets and transport layers are now reported in
"show sess $PTR", as it is an absolute requirement in debugging.

include/proto/checks.h
include/proto/session.h
src/dumpstats.c

index 69c5d2aadd155e112231364f5ac75f556b290de3..042b85405f7e62e4a963ffc6f30fc6bac70a94c9 100644 (file)
@@ -32,6 +32,8 @@ void set_server_up(struct server *s);
 int start_checks();
 void health_adjust(struct server *s, short status);
 
+extern struct data_cb check_conn_cb;
+
 #endif /* _PROTO_CHECKS_H */
 
 /*
index a17aa94b2fc759e0766da027571496975b70181e..463b2e4b02fdbba093fec940ff0229789a38cf92 100644 (file)
@@ -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. */
index 8264506d7030fbe8a8f405eb2934a73684003de6..cd00e5b77ff3b081167adc3ac8afae78804a3e2c 100644 (file)
@@ -3478,11 +3478,11 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si)
                             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,17 +3490,59 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si)
                             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),
                                             TICKS_TO_MS(1000)) : "<NEVER>",
                             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,