]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: provide a few helpers to retrieve frontend, listener and origin
authorWilly Tarreau <w@1wt.eu>
Sat, 4 Apr 2015 00:10:38 +0000 (02:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 Apr 2015 09:37:29 +0000 (11:37 +0200)
Expressions are quite long when using strm_sess(strm)->whatever, so let's
provide a few helpers : strm_fe(), strm_li(), strm_orig().

include/proto/stream.h
src/backend.c
src/compression.c
src/dumpstats.c
src/peers.c
src/proto_http.c
src/proxy.c
src/stream.c

index 1cd506a04b1ac3a3b1d169417b2c8d3e1d6ff697..eade0285050d9d2515fc830779d6d00be2d62700 100644 (file)
@@ -68,6 +68,24 @@ static inline struct session *strm_sess(const struct stream *strm)
        return strm->sess;
 }
 
+/* returns the frontend this stream was initiated from */
+static inline struct proxy *strm_fe(const struct stream *strm)
+{
+       return strm->sess->fe;
+}
+
+/* returns the listener this stream was initiated from */
+static inline struct listener *strm_li(const struct stream *strm)
+{
+       return strm->sess->listener;
+}
+
+/* returns a pointer to the origin of the session which created this stream */
+static inline enum obj_type *strm_orig(const struct stream *strm)
+{
+       return strm->sess->origin;
+}
+
 /* sets the stick counter's entry pointer */
 static inline void stkctr_set_entry(struct stkctr *stkctr, struct stksess *entry)
 {
index 0d18dd734271a3a5b2a99a79cbc78f770748a7ad..75792bde0d144a696d11bda405e3b2763679441a 100644 (file)
@@ -607,7 +607,7 @@ int assign_server(struct stream *s)
 
                        switch (s->be->lbprm.algo & BE_LB_PARM) {
                        case BE_LB_HASH_SRC:
-                               conn = objt_conn(strm_sess(s)->origin);
+                               conn = objt_conn(strm_orig(s));
                                if (conn && conn->addr.from.ss_family == AF_INET) {
                                        srv = get_server_sh(s->be,
                                                            (void *)&((struct sockaddr_in *)&conn->addr.from)->sin_addr,
@@ -746,7 +746,7 @@ int assign_server(struct stream *s)
  */
 int assign_server_address(struct stream *s)
 {
-       struct connection *cli_conn = objt_conn(strm_sess(s)->origin);
+       struct connection *cli_conn = objt_conn(strm_orig(s));
        struct connection *srv_conn = objt_conn(s->si[1].end);
 
 #ifdef DEBUG_FULL
@@ -966,7 +966,7 @@ static void assign_tproxy_address(struct stream *s)
        case CO_SRC_TPROXY_CLI:
        case CO_SRC_TPROXY_CIP:
                /* FIXME: what can we do if the client connects in IPv6 or unix socket ? */
-               cli_conn = objt_conn(strm_sess(s)->origin);
+               cli_conn = objt_conn(strm_orig(s));
                if (cli_conn)
                        srv_conn->addr.from = cli_conn->addr.from;
                else
@@ -1074,7 +1074,7 @@ int connect_server(struct stream *s)
                srv_conn->send_proxy_ofs = 0;
                if (objt_server(s->target) && objt_server(s->target)->pp_opts) {
                        srv_conn->send_proxy_ofs = 1; /* must compute size */
-                       cli_conn = objt_conn(strm_sess(s)->origin);
+                       cli_conn = objt_conn(strm_orig(s));
                        if (cli_conn)
                                conn_get_to_addr(cli_conn);
                }
@@ -1090,7 +1090,7 @@ int connect_server(struct stream *s)
        }
 
        /* flag for logging source ip/port */
-       if (strm_sess(s)->fe->options2 & PR_O2_SRC_ADDR)
+       if (strm_fe(s)->options2 & PR_O2_SRC_ADDR)
                s->si[1].flags |= SI_FL_SRC_ADDR;
 
        /* disable lingering */
index 814c24f184ae75f6c052d3a77e0aebf4abc2ce77..dc5ad5aa47e9c06dcb6eea90a0ee6215e5837caf 100644 (file)
@@ -319,10 +319,10 @@ int http_compression_buffer_end(struct stream *s, struct buffer **in, struct buf
        /* update input rate */
        if (s->comp_ctx && s->comp_ctx->cur_lvl > 0) {
                update_freq_ctr(&global.comp_bps_in, msg->next);
-               strm_sess(s)->fe->fe_counters.comp_in += msg->next;
+               strm_fe(s)->fe_counters.comp_in += msg->next;
                s->be->be_counters.comp_in += msg->next;
        } else {
-               strm_sess(s)->fe->fe_counters.comp_byp += msg->next;
+               strm_fe(s)->fe_counters.comp_byp += msg->next;
                s->be->be_counters.comp_byp += msg->next;
        }
 
@@ -346,7 +346,7 @@ int http_compression_buffer_end(struct stream *s, struct buffer **in, struct buf
 
        if (s->comp_ctx && s->comp_ctx->cur_lvl > 0) {
                update_freq_ctr(&global.comp_bps_out, to_forward);
-               strm_sess(s)->fe->fe_counters.comp_out += to_forward;
+               strm_fe(s)->fe_counters.comp_out += to_forward;
                s->be->be_counters.comp_out += to_forward;
        }
 
index c24f81551301c7899eeb4ffd9b3c63fdae578e0e..de8633914282390d2f2573e830f6d1c7ffbce6b9 100644 (file)
@@ -551,7 +551,7 @@ static int stats_dump_table_head_to_buffer(struct chunk *msg, struct stream_inte
 
        /* any other information should be dumped here */
 
-       if (target && strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_OPER)
+       if (target && strm_li(s)->bind_conf->level < ACCESS_LVL_OPER)
                chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n");
 
        if (bi_putchk(si_ic(si), msg) == -1) {
@@ -705,7 +705,7 @@ static void stats_sock_table_key_request(struct stream_interface *si, char **arg
        }
 
        /* check permissions */
-       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_OPER) {
+       if (strm_li(s)->bind_conf->level < ACCESS_LVL_OPER) {
                appctx->ctx.cli.msg = stats_permission_denied_msg;
                appctx->st0 = STAT_CLI_PRINT;
                return;
@@ -905,7 +905,7 @@ static struct proxy *expect_frontend_admin(struct stream *s, struct stream_inter
        struct appctx *appctx = __objt_appctx(si->end);
        struct proxy *px;
 
-       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+       if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                appctx->ctx.cli.msg = stats_permission_denied_msg;
                appctx->st0 = STAT_CLI_PRINT;
                return NULL;
@@ -938,7 +938,7 @@ static struct server *expect_server_admin(struct stream *s, struct stream_interf
        struct server *sv;
        char *line;
 
-       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+       if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                appctx->ctx.cli.msg = stats_permission_denied_msg;
                appctx->st0 = STAT_CLI_PRINT;
                return NULL;
@@ -1111,7 +1111,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                }
                else if (strcmp(args[1], "sess") == 0) {
                        appctx->st2 = STAT_ST_INIT;
-                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_OPER) {
+                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_OPER) {
                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                appctx->st0 = STAT_CLI_PRINT;
                                return 1;
@@ -1127,7 +1127,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                        appctx->st0 = STAT_CLI_O_SESS; // stats_dump_sess_to_buffer
                }
                else if (strcmp(args[1], "errors") == 0) {
-                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_OPER) {
+                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_OPER) {
                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                appctx->st0 = STAT_CLI_PRINT;
                                return 1;
@@ -1188,8 +1188,8 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                                clrall = 1;
 
                        /* check permissions */
-                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_OPER ||
-                           (clrall && strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN)) {
+                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_OPER ||
+                           (clrall && strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN)) {
                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                appctx->st0 = STAT_CLI_PRINT;
                                return 1;
@@ -1511,15 +1511,15 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                                                resume_listener(l);
                                }
 
-                               if (px->maxconn > px->feconn && !LIST_ISEMPTY(&strm_sess(s)->fe->listener_queue))
-                                       dequeue_all_listeners(&strm_sess(s)->fe->listener_queue);
+                               if (px->maxconn > px->feconn && !LIST_ISEMPTY(&strm_fe(s)->listener_queue))
+                                       dequeue_all_listeners(&strm_fe(s)->listener_queue);
 
                                return 1;
                        }
                        else if (strcmp(args[2], "global") == 0) {
                                int v;
 
-                               if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+                               if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                                        appctx->ctx.cli.msg = stats_permission_denied_msg;
                                        appctx->st0 = STAT_CLI_PRINT;
                                        return 1;
@@ -1561,7 +1561,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                                if (strcmp(args[3], "global") == 0) {
                                        int v;
 
-                                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+                                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                                appctx->st0 = STAT_CLI_PRINT;
                                                return 1;
@@ -1598,7 +1598,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                                if (strcmp(args[3], "global") == 0) {
                                        int v;
 
-                                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+                                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                                appctx->st0 = STAT_CLI_PRINT;
                                                return 1;
@@ -1636,7 +1636,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                                if (strcmp(args[3], "global") == 0) {
                                        int v;
 
-                                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+                                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                                appctx->st0 = STAT_CLI_PRINT;
                                                return 1;
@@ -1981,7 +1981,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                else if (strcmp(args[1], "session") == 0) {
                        struct stream *sess, *ptr;
 
-                       if (strm_sess(s)->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
+                       if (strm_li(s)->bind_conf->level < ACCESS_LVL_ADMIN) {
                                appctx->ctx.cli.msg = stats_permission_denied_msg;
                                appctx->st0 = STAT_CLI_PRINT;
                                return 1;
@@ -5020,9 +5020,9 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
                             tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900,
                             tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(sess->logs.accept_date.tv_usec),
                             sess->uniq_id,
-                            strm_sess(sess)->listener && strm_sess(sess)->listener->proto->name ? strm_sess(sess)->listener->proto->name : "?");
+                            strm_li(sess) && strm_li(sess)->proto->name ? strm_li(sess)->proto->name : "?");
 
-               conn = objt_conn(strm_sess(sess)->origin);
+               conn = objt_conn(strm_orig(sess));
                switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
                case AF_INET:
                case AF_INET6:
@@ -5030,7 +5030,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
                                      pn, get_host_port(&conn->addr.from));
                        break;
                case AF_UNIX:
-                       chunk_appendf(&trash, " source=unix:%d\n", strm_sess(sess)->listener->luid);
+                       chunk_appendf(&trash, " source=unix:%d\n", strm_li(sess)->luid);
                        break;
                default:
                        /* no more information to print right now */
@@ -5044,9 +5044,9 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
 
                chunk_appendf(&trash,
                             "  frontend=%s (id=%u mode=%s), listener=%s (id=%u)",
-                            strm_sess(sess)->fe->id, strm_sess(sess)->fe->uuid, strm_sess(sess)->fe->mode ? "http" : "tcp",
-                            strm_sess(sess)->listener ? strm_sess(sess)->listener->name ? strm_sess(sess)->listener->name : "?" : "?",
-                            strm_sess(sess)->listener ? strm_sess(sess)->listener->luid : 0);
+                            strm_fe(sess)->id, strm_fe(sess)->uuid, strm_fe(sess)->mode ? "http" : "tcp",
+                            strm_li(sess) ? strm_li(sess)->name ? strm_li(sess)->name : "?" : "?",
+                            strm_li(sess) ? strm_li(sess)->luid : 0);
 
                if (conn)
                        conn_get_to_addr(conn);
@@ -5058,7 +5058,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
                                     pn, get_host_port(&conn->addr.to));
                        break;
                case AF_UNIX:
-                       chunk_appendf(&trash, " addr=unix:%d\n", strm_sess(sess)->listener->luid);
+                       chunk_appendf(&trash, " addr=unix:%d\n", strm_li(sess)->luid);
                        break;
                default:
                        /* no more information to print right now */
@@ -5602,10 +5602,10 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
                        chunk_appendf(&trash,
                                     "%p: proto=%s",
                                     curr_sess,
-                                    strm_sess(curr_sess)->listener->proto->name);
+                                    strm_li(curr_sess)->proto->name);
 
 
-                       conn = objt_conn(strm_sess(curr_sess)->origin);
+                       conn = objt_conn(strm_orig(curr_sess));
                        switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
                        case AF_INET:
                        case AF_INET6:
@@ -5613,7 +5613,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
                                             " src=%s:%d fe=%s be=%s srv=%s",
                                             pn,
                                             get_host_port(&conn->addr.from),
-                                            strm_sess(curr_sess)->fe->id,
+                                            strm_fe(curr_sess)->id,
                                             (curr_sess->be->cap & PR_CAP_BE) ? curr_sess->be->id : "<NONE>",
                                             objt_server(curr_sess->target) ? objt_server(curr_sess->target)->id : "<none>"
                                             );
@@ -5621,8 +5621,8 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
                        case AF_UNIX:
                                chunk_appendf(&trash,
                                             " src=unix:%d fe=%s be=%s srv=%s",
-                                            strm_sess(curr_sess)->listener->luid,
-                                            strm_sess(curr_sess)->fe->id,
+                                            strm_li(curr_sess)->luid,
+                                            strm_fe(curr_sess)->id,
                                             (curr_sess->be->cap & PR_CAP_BE) ? curr_sess->be->id : "<NONE>",
                                             objt_server(curr_sess->target) ? objt_server(curr_sess->target)->id : "<none>"
                                             );
@@ -5828,7 +5828,7 @@ static int stats_table_request(struct stream_interface *si, int action)
                                        return 0;
 
                                if (appctx->ctx.table.target &&
-                                   strm_sess(s)->listener->bind_conf->level >= ACCESS_LVL_OPER) {
+                                   strm_li(s)->bind_conf->level >= ACCESS_LVL_OPER) {
                                        /* dump entries only if table explicitly requested */
                                        eb = ebmb_first(&appctx->ctx.table.proxy->table.keys);
                                        if (eb) {
index b5d1d8e0bcc9bbb063a244ae7578a9e60e55fe27..882633b3e7c83eb1c2736e807643067e5e1edd4a 100644 (file)
@@ -215,7 +215,7 @@ static void peer_session_release(struct stream_interface *si)
 static void peer_io_handler(struct stream_interface *si)
 {
        struct stream *s = si_strm(si);
-       struct peers *curpeers = (struct peers *)strm_sess(s)->fe->parent;
+       struct peers *curpeers = (struct peers *)strm_fe(s)->parent;
        struct appctx *appctx = objt_appctx(si->end);
        int reql = 0;
        int repl = 0;
index 1cb30635c32c8126c5365d92dd9cca4b9ccd7ef8..338ae9e73261de7ddb3af7364dcab24b4c4d8aae 100644 (file)
@@ -851,8 +851,8 @@ struct chunk *http_error_message(struct stream *s, int msgnum)
 {
        if (s->be->errmsg[msgnum].str)
                return &s->be->errmsg[msgnum];
-       else if (strm_sess(s)->fe->errmsg[msgnum].str)
-               return &strm_sess(s)->fe->errmsg[msgnum];
+       else if (strm_fe(s)->errmsg[msgnum].str)
+               return &strm_fe(s)->errmsg[msgnum];
        else
                return &http_err_chunks[msgnum];
 }
@@ -2264,7 +2264,7 @@ int select_compression_request_header(struct stream *s, struct buffer *req)
        }
 
        /* search for the algo in the backend in priority or the frontend */
-       if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (strm_sess(s)->fe->comp && (comp_algo_back = strm_sess(s)->fe->comp->algos))) {
+       if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (strm_fe(s)->comp && (comp_algo_back = strm_fe(s)->comp->algos))) {
                int best_q = 0;
 
                ctx.idx = 0;
@@ -2322,7 +2322,7 @@ int select_compression_request_header(struct stream *s, struct buffer *req)
 
        /* remove all occurrences of the header when "compression offload" is set */
        if (s->comp_algo) {
-               if ((s->be->comp && s->be->comp->offload) || (strm_sess(s)->fe->comp && strm_sess(s)->fe->comp->offload)) {
+               if ((s->be->comp && s->be->comp->offload) || (strm_fe(s)->comp && strm_fe(s)->comp->offload)) {
                        http_remove_header2(msg, &txn->hdr_idx, &ctx);
                        ctx.idx = 0;
                        while (http_find_header2("Accept-Encoding", 15, req->p, &txn->hdr_idx, &ctx)) {
@@ -2333,7 +2333,7 @@ int select_compression_request_header(struct stream *s, struct buffer *req)
        }
 
        /* identity is implicit does not require headers */
-       if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (strm_sess(s)->fe->comp && (comp_algo_back = strm_sess(s)->fe->comp->algos))) {
+       if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (strm_fe(s)->comp && (comp_algo_back = strm_fe(s)->comp->algos))) {
                for (comp_algo = comp_algo_back; comp_algo; comp_algo = comp_algo->next) {
                        if (comp_algo->cfg_name_len == 8 && memcmp(comp_algo->cfg_name, "identity", 8) == 0) {
                                s->comp_algo = comp_algo;
@@ -2400,7 +2400,7 @@ int select_compression_response_header(struct stream *s, struct buffer *res)
                        goto fail;
 
                if ((s->be->comp && (comp_type = s->be->comp->types)) ||
-                   (strm_sess(s)->fe->comp && (comp_type = strm_sess(s)->fe->comp->types))) {
+                   (strm_fe(s)->comp && (comp_type = strm_fe(s)->comp->types))) {
                        for (; comp_type; comp_type = comp_type->next) {
                                if (ctx.vlen >= comp_type->name_len &&
                                    strncasecmp(ctx.line+ctx.val, comp_type->name, comp_type->name_len) == 0)
@@ -2413,7 +2413,7 @@ int select_compression_response_header(struct stream *s, struct buffer *res)
                }
        }
        else { /* no content-type header */
-               if ((s->be->comp && s->be->comp->types) || (strm_sess(s)->fe->comp && strm_sess(s)->fe->comp->types))
+               if ((s->be->comp && s->be->comp->types) || (strm_fe(s)->comp && strm_fe(s)->comp->types))
                        goto fail; /* a content-type was required */
        }
 
@@ -2464,7 +2464,7 @@ fail:
 
 void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_msg *msg)
 {
-       struct proxy *fe = strm_sess(s)->fe;
+       struct proxy *fe = strm_fe(s);
        int tmp = TX_CON_WANT_KAL;
 
        if (!((fe->options2|s->be->options2) & PR_O2_FAKE_KA)) {
@@ -4907,7 +4907,7 @@ int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* sr
 void http_end_txn_clean_session(struct stream *s)
 {
        int prev_status = s->txn->status;
-       struct proxy *fe = strm_sess(s)->fe;
+       struct proxy *fe = strm_fe(s);
 
        /* FIXME: We need a more portable way of releasing a backend's and a
         * server's connections. We need a safer way to reinitialize buffer
@@ -5062,7 +5062,7 @@ void http_end_txn_clean_session(struct stream *s)
        /* we're in keep-alive with an idle connection, monitor it */
        si_idle_conn(&s->si[1]);
 
-       s->req.analysers = strm_sess(s)->listener->analysers;
+       s->req.analysers = strm_li(s)->analysers;
        s->res.analysers = 0;
 }
 
@@ -6988,7 +6988,7 @@ int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hd
                                 * FIXME: should we return an HTTP/500 here so that
                                 * the admin knows there's a problem ?
                                 */
-                               if (s->be != strm_sess(s)->fe)
+                               if (s->be != strm_fe(s))
                                        break;
 
                                /* Swithing Proxy */
@@ -7089,7 +7089,7 @@ int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_e
                         * FIXME: should we return an HTTP/500 here so that
                         * the admin knows there's a problem ?
                         */
-                       if (s->be != strm_sess(s)->fe)
+                       if (s->be != strm_fe(s))
                                break;
 
                        /* Swithing Proxy */
@@ -8830,7 +8830,7 @@ struct http_txn *http_alloc_txn(struct stream *s)
 void http_init_txn(struct stream *s)
 {
        struct http_txn *txn = s->txn;
-       struct proxy *fe = strm_sess(s)->fe;
+       struct proxy *fe = strm_fe(s);
 
        txn->flags = 0;
        txn->status = -1;
@@ -8872,7 +8872,7 @@ void http_init_txn(struct stream *s)
 void http_end_txn(struct stream *s)
 {
        struct http_txn *txn = s->txn;
-       struct proxy *fe = strm_sess(s)->fe;
+       struct proxy *fe = strm_fe(s);
 
        /* release any possible compression context */
        if (s->flags & SF_COMP_READY)
@@ -8920,8 +8920,8 @@ void http_reset_txn(struct stream *s)
         */
        s->current_rule_list = NULL;
 
-       s->be = strm_sess(s)->fe;
-       s->logs.logwait = strm_sess(s)->fe->to_log;
+       s->be = strm_fe(s);
+       s->logs.logwait = strm_fe(s)->to_log;
        s->logs.level = 0;
        stream_del_srv_conn(s);
        s->target = NULL;
@@ -8944,11 +8944,11 @@ void http_reset_txn(struct stream *s)
        if (unlikely(s->res.buf->i))
                s->res.buf->i = 0;
 
-       s->req.rto = strm_sess(s)->fe->timeout.client;
+       s->req.rto = strm_fe(s)->timeout.client;
        s->req.wto = TICK_ETERNITY;
 
        s->res.rto = TICK_ETERNITY;
-       s->res.wto = strm_sess(s)->fe->timeout.client;
+       s->res.wto = strm_fe(s)->timeout.client;
 
        s->req.rex = TICK_ETERNITY;
        s->req.wex = TICK_ETERNITY;
@@ -10887,7 +10887,7 @@ static int
 smp_fetch_capture_header_req(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct proxy *fe = strm_sess(strm)->fe;
+       struct proxy *fe = strm_fe(strm);
        int idx;
 
        if (!args || args->type != ARGT_UINT)
@@ -10913,7 +10913,7 @@ static int
 smp_fetch_capture_header_res(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct proxy *fe = strm_sess(strm)->fe;
+       struct proxy *fe = strm_fe(strm);
        int idx;
 
        if (!args || args->type != ARGT_UINT)
index f55aaa48a4807475d994e5379f8b6fd2cc05049a..12e8aa333768000e3abee6c00814f82451bc1dc4 100644 (file)
@@ -959,8 +959,8 @@ int stream_set_backend(struct stream *s, struct proxy *be)
                 * have to re-adjust the desired keep-alive/close mode to accommodate
                 * both the frontend's and the backend's modes.
                 */
-               if (strm_sess(s)->fe->mode == PR_MODE_HTTP && be->mode == PR_MODE_HTTP &&
-                   ((strm_sess(s)->fe->options & PR_O_HTTP_MODE) != (be->options & PR_O_HTTP_MODE)))
+               if (strm_fe(s)->mode == PR_MODE_HTTP && be->mode == PR_MODE_HTTP &&
+                   ((strm_fe(s)->options & PR_O_HTTP_MODE) != (be->options & PR_O_HTTP_MODE)))
                        http_adjust_conn_mode(s, s->txn, &s->txn->req);
 
                /* If an LB algorithm needs to access some pre-parsed body contents,
@@ -984,7 +984,7 @@ int stream_set_backend(struct stream *s, struct proxy *be)
         * be more reliable to store the list of analysers that have been run,
         * but what we do here is OK for now.
         */
-       s->req.analysers |= be->be_req_ana & ~strm_sess(s)->listener->analysers;
+       s->req.analysers |= be->be_req_ana & ~strm_li(s)->analysers;
 
        return 1;
 }
index 91c2a0d8cf3d723ca87004ccbe3c59c95097df90..ba6f4999223979f260fabf9bb1e63a37683d515a 100644 (file)
@@ -1062,7 +1062,7 @@ static void sess_establish(struct stream *s)
        if (s->be->mode == PR_MODE_TCP) { /* let's allow immediate data connection in this case */
                /* if the user wants to log as soon as possible, without counting
                 * bytes from the server, then this is the right moment. */
-               if (!LIST_ISEMPTY(&strm_sess(s)->fe->logformat) && !(s->logs.logwait & LW_BYTES)) {
+               if (!LIST_ISEMPTY(&strm_fe(s)->logformat) && !(s->logs.logwait & LW_BYTES)) {
                        s->logs.t_close = s->logs.t_connect; /* to get a valid end date */
                        s->do_log(s);
                }
@@ -1071,7 +1071,7 @@ static void sess_establish(struct stream *s)
                rep->flags |= CF_READ_DONTWAIT; /* a single read is enough to get response headers */
        }
 
-       rep->analysers |= strm_sess(s)->fe->fe_rsp_ana | s->be->be_rsp_ana;
+       rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana;
        rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
        if (req->flags & CF_WAKE_CONNECT) {
                req->flags |= CF_WAKE_ONCE;
@@ -1264,9 +1264,9 @@ static void sess_set_term_flags(struct stream *s)
        if (!(s->flags & SF_FINST_MASK)) {
                if (s->si[1].state < SI_ST_REQ) {
 
-                       strm_sess(s)->fe->fe_counters.failed_req++;
-                       if (strm_sess(s)->listener->counters)
-                               strm_sess(s)->listener->counters->failed_req++;
+                       strm_fe(s)->fe_counters.failed_req++;
+                       if (strm_li(s)->counters)
+                               strm_li(s)->counters->failed_req++;
 
                        s->flags |= SF_FINST_R;
                }