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.
This commit is contained in:
Willy Tarreau 2012-11-19 16:10:32 +01:00
parent bf3ae61789
commit bc174aa144
3 changed files with 50 additions and 4 deletions

View 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 */
/*

View 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. */

View 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,