MINOR: stream: provide a few helpers to retrieve frontend, listener and origin
Expressions are quite long when using strm_sess(strm)->whatever, so let's
provide a few helpers : strm_fe(), strm_li(), strm_orig().
diff --git a/src/backend.c b/src/backend.c
index 0d18dd7..75792bd 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -607,7 +607,7 @@
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_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 @@
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 @@
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 @@
}
/* 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 */