/* we have a dedicated I/O handler for the stats */
stream_int_register_handler(&s->si[1], &cli_applet);
s->target = s->si[1].conn->target; // for logging only
- s->si[1].conn->xprt_ctx = s;
s->si[1].applet.st1 = 0;
s->si[1].applet.st0 = STAT_CLI_INIT;
static int stats_dump_table_head_to_buffer(struct chunk *msg, struct stream_interface *si,
struct proxy *proxy, struct proxy *target)
{
- struct session *s = si->conn->xprt_ctx;
+ struct session *s = session_from_task(si->owner);
chunk_appendf(msg, "# table: %s, type: %s, size:%d, used:%d\n",
proxy->id, stktable_types[proxy->table.type].kw, proxy->table.size, proxy->table.current);
static void stats_sock_table_key_request(struct stream_interface *si, char **args, int action)
{
- struct session *s = si->conn->xprt_ctx;
+ struct session *s = session_from_task(si->owner);
struct proxy *px = si->applet.ctx.table.target;
struct stksess *ts;
uint32_t uint32_key;
*/
static int stats_sock_parse_request(struct stream_interface *si, char *line)
{
- struct session *s = si->conn->xprt_ctx;
+ struct session *s = session_from_task(si->owner);
char *args[MAX_STATS_ARGS + 1];
int arg;
*/
static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, struct uri_auth *uri)
{
- struct session *s = si->conn->xprt_ctx;
+ struct session *s = session_from_task(si->owner);
struct channel *rep = si->ib;
struct server *sv, *svs; /* server and server-state, server-state=server or server->track */
struct listener *l;
/* This function dumps statistics onto the stream interface's read buffer in
* either CSV or HTML format. <uri> contains some HTML-specific parameters that
- * are ignored for CSV format (hence <uri> may be NULL there). The xprt_ctx must
- * have been zeroed first, and the flags properly set. It returns 0 if it had to
- * stop writing data and an I/O is needed, 1 if the dump is finished and the
- * session must be closed, or -1 in case of any error. This function is used by
- * both the CLI and the HTTP handlers.
+ * are ignored for CSV format (hence <uri> may be NULL there). It returns 0 if
+ * it had to stop writing data and an I/O is needed, 1 if the dump is finished
+ * and the session must be closed, or -1 in case of any error. This function is
+ * used by both the CLI and the HTTP handlers.
*/
static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_auth *uri)
{
*/
static void http_stats_io_handler(struct stream_interface *si)
{
- struct session *s = si->conn->xprt_ctx;
+ struct session *s = session_from_task(si->owner);
struct channel *req = si->ob;
struct channel *res = si->ib;
}
/* This function dumps a complete session state onto the stream interface's
- * read buffer. The xprt_ctx must have been zeroed first, and the flags
- * properly set. The session has to be set in xprt_ctx.sess.target. It returns
+ * read buffer. The session has to be set in sess->target. It returns
* 0 if the output buffer is full and it needs to be called again, otherwise
* non-zero. It is designed to be called from stats_dump_sess_to_buffer() below.
*/
}
/* This function dumps all sessions' states onto the stream interface's
- * read buffer. The xprt_ctx must have been zeroed first, and the flags
- * properly set. It returns 0 if the output buffer is full and it needs
+ * read buffer. It returns 0 if the output buffer is full and it needs
* to be called again, otherwise non-zero. It is designed to be called
* from stats_dump_sess_to_buffer() below.
*/
/* This function is used to either dump tables states (when action is set
* to STAT_CLI_O_TAB) or clear tables (when action is STAT_CLI_O_CLR).
- * The xprt_ctx must have been zeroed first, and the flags properly set.
* It returns 0 if the output buffer is full and it needs to be called
* again, otherwise non-zero.
*/
static int stats_table_request(struct stream_interface *si, int action)
{
- struct session *s = si->conn->xprt_ctx;
+ struct session *s = session_from_task(si->owner);
struct ebmb_node *eb;
int dt;
int skip_entry;
}
/* This function dumps all captured errors onto the stream interface's
- * read buffer. The xprt_ctx must have been zeroed first, and the flags
- * properly set. It returns 0 if the output buffer is full and it needs
+ * read buffer. It returns 0 if the output buffer is full and it needs
* to be called again, otherwise non-zero.
*/
static int stats_dump_errors_to_buffer(struct stream_interface *si)