MINOR: stream: Add pointer to front/back conn-streams into stream struct
frontend and backend conn-streams are now directly accesible from the
stream. This way, and with some other changes, it will be possible to remove
the stream-interfaces from the stream structure.
diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h
index 7a7df2a..c9c3d6e 100644
--- a/include/haproxy/conn_stream.h
+++ b/include/haproxy/conn_stream.h
@@ -139,7 +139,12 @@
appctx->applet->release(appctx);
appctx_free(appctx);
}
- cs_init(cs);
+
+ /* Rest CS */
+ cs->flags = CS_FL_NONE;
+ cs->end = NULL;
+ cs->ctx = NULL;
+ cs->data_cb = NULL;
}
/* Release a conn_stream */
diff --git a/include/haproxy/stream-t.h b/include/haproxy/stream-t.h
index e44d2ac..7e8a257 100644
--- a/include/haproxy/stream-t.h
+++ b/include/haproxy/stream-t.h
@@ -88,6 +88,7 @@
#define PCLI_F_PROMPT 0x10000
#define PCLI_F_PAYLOAD 0x20000
+struct conn_stream;
struct hlua;
struct proxy;
struct pendconn;
@@ -163,6 +164,9 @@
struct vars vars_txn; /* list of variables for the txn scope. */
struct vars vars_reqres; /* list of variables for the request and resp scope. */
+ struct conn_stream *csf; /* frontend conn-stream */
+ struct conn_stream *csb; /* backend conn-stream */
+
struct stream_interface si[2]; /* client and server stream interfaces */
struct strm_logs logs; /* logs for this stream */
diff --git a/src/backend.c b/src/backend.c
index 8367a8e..34b53af 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1496,7 +1496,7 @@
if (avail >= 1) {
si_attach_conn(&s->si[1], srv_conn);
- if (srv_conn->mux->attach(srv_conn, s->si[1].cs, s->sess) == -1) {
+ if (srv_conn->mux->attach(srv_conn, s->csb, s->sess) == -1) {
si_reset_endpoint(&s->si[1]);
srv_conn = NULL;
}
@@ -1679,7 +1679,7 @@
if (init_mux) {
const struct mux_ops *alt_mux =
likely(!(s->flags & SF_WEBSOCKET)) ? NULL : srv_get_ws_proto(srv);
- if (conn_install_mux_be(srv_conn, s->si[1].cs, s->sess, alt_mux) < 0) {
+ if (conn_install_mux_be(srv_conn, s->csb, s->sess, alt_mux) < 0) {
conn_full_close(srv_conn);
return SF_ERR_INTERNAL;
}
@@ -1741,7 +1741,7 @@
* sockets, socket pairs, and occasionally TCP connections on the
* loopback on a heavily loaded system.
*/
- if ((srv_conn->flags & CO_FL_ERROR || (s->si[1].cs)->flags & CS_FL_ERROR))
+ if ((srv_conn->flags & CO_FL_ERROR || s->csb->flags & CS_FL_ERROR))
s->si[1].flags |= SI_FL_ERR;
/* If we had early data, and the handshake ended, then
@@ -1750,7 +1750,7 @@
* the handshake.
*/
if (!(srv_conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS)))
- (s->si[1].cs)->flags &= ~CS_FL_WAIT_FOR_HS;
+ s->csb->flags &= ~CS_FL_WAIT_FOR_HS;
if (!si_state_in(s->si[1].state, SI_SB_EST|SI_SB_DIS|SI_SB_CLO) &&
(srv_conn->flags & CO_FL_WAIT_XPRT) == 0) {
@@ -1767,7 +1767,7 @@
* wake callback. Otherwise si_cs_recv()/si_cs_send() already take
* care of it.
*/
- if (((s->si[1].cs)->flags & CS_FL_EOI) && !(si_ic(&s->si[1])->flags & CF_EOI))
+ if ((s->csb->flags & CS_FL_EOI) && !(si_ic(&s->si[1])->flags & CF_EOI))
si_ic(&s->si[1])->flags |= (CF_EOI|CF_READ_PARTIAL);
/* catch all sync connect while the mux is not already installed */
@@ -2076,7 +2076,7 @@
*/
void back_handle_st_req(struct stream *s)
{
- struct stream_interface *si = &s->si[1];
+ struct stream_interface *si = cs_si(s->csb);
if (si->state != SI_ST_REQ)
return;
@@ -2085,7 +2085,7 @@
if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
/* the applet directly goes to the EST state */
- struct appctx *appctx = cs_appctx(si->cs);
+ struct appctx *appctx = cs_appctx(s->csb);
if (!appctx || appctx->applet != __objt_applet(s->target))
appctx = si_register_handler(si, objt_applet(s->target));
@@ -2211,7 +2211,7 @@
*/
void back_handle_st_cer(struct stream *s)
{
- struct stream_interface *si = &s->si[1];
+ struct stream_interface *si = cs_si(s->csb);
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_SI_ST, s);
@@ -2220,7 +2220,7 @@
/* we probably have to release last stream from the server */
if (objt_server(s->target)) {
- struct connection *conn = cs_conn(si->cs);
+ struct connection *conn = cs_conn(s->csb);
health_adjust(__objt_server(s->target), HANA_STATUS_L4_ERR);
diff --git a/src/cache.c b/src/cache.c
index ac4c682..b4918e7 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -2649,7 +2649,7 @@
return 0;
/* Get appctx from the stream_interface. */
- appctx = cs_appctx(smp->strm->si[1].cs);
+ appctx = cs_appctx(smp->strm->csb);
if (appctx && appctx->rule) {
cconf = appctx->rule->arg.act.p[0];
if (cconf) {
diff --git a/src/connection.c b/src/connection.c
index ee135ba..60cbd22 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2018,7 +2018,7 @@
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
/* No connection or a connection with a RAW muxx */
if (!conn || (conn->mux && !(conn->mux->flags & MX_FL_HTX)))
@@ -2115,7 +2115,7 @@
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn)
return 0;
@@ -2142,7 +2142,7 @@
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn)
return 0;
diff --git a/src/frontend.c b/src/frontend.c
index 56371da..1016a1b 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -105,7 +105,7 @@
int alpn_len;
/* try to report the ALPN value when available (also works for NPN) */
- if (conn == cs_conn(s->si[0].cs)) {
+ if (conn == cs_conn(s->csf)) {
if (conn_get_alpn(conn, &alpn_str, &alpn_len) && alpn_str) {
int len = MIN(alpn_len, sizeof(alpn) - 1);
memcpy(alpn, alpn_str, len);
diff --git a/src/hlua.c b/src/hlua.c
index 219cd26..cc7a585 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -2617,7 +2617,7 @@
si = cs_si(appctx->owner);
s = si_strm(si);
- conn = cs_conn(s->si[1].cs);
+ conn = cs_conn(s->csb);
if (!conn || !conn_get_src(conn)) {
xref_unlock(&socket->xref, peer);
lua_pushnil(L);
@@ -2684,7 +2684,7 @@
return 2;
}
- appctx = cs_appctx(s->si[0].cs);
+ appctx = cs_appctx(s->csf);
/* Check for connection established. */
if (appctx->ctx.hlua_cosocket.connected) {
diff --git a/src/http_ana.c b/src/http_ana.c
index f0f49a7..782c735 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -1325,7 +1325,7 @@
if (unlikely(htx_is_empty(htx) || htx->first == -1)) {
/* 1: have we encountered a read error ? */
if (rep->flags & CF_READ_ERROR) {
- struct connection *conn = cs_conn(s->si[1].cs);
+ struct connection *conn = cs_conn(s->csb);
/* Perform a L7 retry because server refuses the early data. */
if ((si_b->flags & SI_FL_L7_RETRY) &&
@@ -1656,7 +1656,7 @@
/* check for NTML authentication headers in 401 (WWW-Authenticate) and
* 407 (Proxy-Authenticate) responses and set the connection to private
*/
- srv_conn = cs_conn(s->si[1].cs);
+ srv_conn = cs_conn(s->csb);
if (srv_conn) {
struct ist hdr;
struct http_hdr_ctx ctx;
@@ -3873,7 +3873,6 @@
static int http_handle_stats(struct stream *s, struct channel *req)
{
struct stats_admin_rule *stats_admin_rule;
- struct stream_interface *si = &s->si[1];
struct session *sess = s->sess;
struct http_txn *txn = s->txn;
struct http_msg *msg = &txn->req;
@@ -3883,7 +3882,7 @@
struct htx *htx;
struct htx_sl *sl;
- appctx = cs_appctx(si->cs);
+ appctx = cs_appctx(s->csb);
memset(&appctx->ctx.stats, 0, sizeof(appctx->ctx.stats));
appctx->st1 = appctx->st2 = 0;
appctx->ctx.stats.st_code = STAT_STATUS_INIT;
@@ -5004,7 +5003,7 @@
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id,
dir,
objt_conn(sess->origin) ? (unsigned short)__objt_conn(sess->origin)->handle.fd : -1,
- cs_conn(s->si[1].cs) ? (unsigned short)(cs_conn(s->si[1].cs))->handle.fd : -1);
+ cs_conn(s->csb) ? (unsigned short)(cs_conn(s->csb))->handle.fd : -1);
max = HTX_SL_P1_LEN(sl);
UBOUND(max, trash.size - trash.data - 3);
@@ -5035,7 +5034,7 @@
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id,
dir,
objt_conn(sess->origin) ? (unsigned short)__objt_conn(sess->origin)->handle.fd : -1,
- cs_conn(s->si[1].cs) ? (unsigned short)(cs_conn(s->si[1].cs))->handle.fd : -1);
+ cs_conn(s->csb) ? (unsigned short)(cs_conn(s->csb))->handle.fd : -1);
max = n.len;
UBOUND(max, trash.size - trash.data - 3);
@@ -5091,7 +5090,7 @@
struct http_txn *http_create_txn(struct stream *s)
{
struct http_txn *txn;
- struct conn_stream *cs = s->si[0].cs;
+ struct conn_stream *cs = s->csf;
txn = pool_alloc(pool_head_http_txn);
if (!txn)
diff --git a/src/log.c b/src/log.c
index dbcffc6..2c8d20b 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1970,7 +1970,7 @@
if (likely(s)) {
be = s->be;
txn = s->txn;
- be_conn = cs_conn(s->si[1].cs);
+ be_conn = cs_conn(s->csb);
status = (txn ? txn->status : 0);
s_flags = s->flags;
uniq_id = s->uniq_id;
diff --git a/src/ssl_sample.c b/src/ssl_sample.c
index 0a78ecb..a18d66c 100644
--- a/src/ssl_sample.c
+++ b/src/ssl_sample.c
@@ -529,7 +529,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -584,7 +584,7 @@
int i;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -647,7 +647,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
ssl = ssl_sock_get_ssl_object(conn);
@@ -700,7 +700,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -751,7 +751,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -803,7 +803,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -871,7 +871,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -923,7 +923,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -1020,7 +1020,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
ssl = ssl_sock_get_ssl_object(conn);
@@ -1065,7 +1065,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@@ -1122,7 +1122,7 @@
SSL *ssl;
if (conn_server)
- conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
ssl = ssl_sock_get_ssl_object(conn);
@@ -1174,7 +1174,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->data.type = SMP_T_BOOL;
smp->data.u.sint = (conn && conn->xprt == &ssl_sock);
@@ -1211,7 +1211,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
@@ -1234,7 +1234,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@@ -1268,7 +1268,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@@ -1299,7 +1299,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@@ -1331,7 +1331,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@@ -1366,7 +1366,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@@ -1399,7 +1399,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@@ -1437,7 +1437,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@@ -1469,7 +1469,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@@ -1506,7 +1506,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@@ -1655,7 +1655,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -1708,7 +1708,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn || conn->xprt != &ssl_sock)
return 0;
@@ -1841,7 +1841,7 @@
const char *sfx;
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn)
return 0;
@@ -1938,7 +1938,7 @@
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
- smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
+ smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 7f30b8f..83c3a38 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -7735,7 +7735,7 @@
struct conn_stream *cs;
conn = objt_conn(sess->origin);
- cs = s->si[0].cs;
+ cs = s->csf;
if (conn && cs) {
if (conn->flags & (CO_FL_EARLY_SSL_HS | CO_FL_SSL_WAIT_HS)) {
diff --git a/src/stream.c b/src/stream.c
index f018c37..8ceb9bc 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -436,6 +436,8 @@
vars_init_head(&s->vars_txn, SCOPE_TXN);
vars_init_head(&s->vars_reqres, SCOPE_REQ);
+ s->csf = cs;
+
/* this part should be common with other protocols */
if (si_reset(&s->si[0]) < 0)
goto out_fail_alloc;
@@ -474,9 +476,10 @@
if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
s->si[1].flags |= SI_FL_INDEP_STR;
- s->si[1].cs = cs_new(NULL, NULL, &s->obj_type, &s->si[1], NULL);
- if (!s->si[1].cs)
+ s->csb = cs_new(NULL, NULL, &s->obj_type, &s->si[1], NULL);
+ if (!s->csb)
goto out_fail_alloc_cs;
+ s->si[1].cs = s->csb;
stream_init_srv_conn(s);
s->target = sess->listener ? sess->listener->default_target : NULL;
@@ -721,7 +724,7 @@
/* applets do not release session yet */
/* FIXME: Handle it in appctx_free ??? */
- must_free_sess = objt_appctx(sess->origin) && sess->origin == s->si[0].cs->end;
+ must_free_sess = objt_appctx(sess->origin) && sess->origin == s->csf->end;
si_release_endpoint(&s->si[1]);
@@ -873,8 +876,8 @@
*/
static void back_establish(struct stream *s)
{
- struct stream_interface *si = &s->si[1];
- struct connection *conn = cs_conn(si->cs);
+ struct connection *conn = cs_conn(s->csb);
+ struct stream_interface *si = cs_si(s->csb);
struct channel *req = &s->req;
struct channel *rep = &s->res;
@@ -997,12 +1000,12 @@
return ACT_RET_ERR;
/* Initialise the context. */
- appctx = cs_appctx(s->si[1].cs);
+ appctx = cs_appctx(s->csb);
memset(&appctx->ctx, 0, sizeof(appctx->ctx));
appctx->rule = rule;
}
else
- appctx = cs_appctx(s->si[1].cs);
+ appctx = cs_appctx(s->csb);
/* Stops the applet scheduling, in case of the init function miss
* some data.
@@ -1475,7 +1478,7 @@
*/
int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_proto)
{
- struct conn_stream *cs = s->si[0].cs;
+ struct conn_stream *cs = s->csf;
struct connection *conn;
/* Already an HTTP stream */
@@ -3190,7 +3193,7 @@
else
chunk_appendf(&trash, " backend=<NONE> (id=-1 mode=-)");
- conn = cs_conn(strm->si[1].cs);
+ conn = cs_conn(strm->csb);
switch (conn && conn_get_src(conn) ? addr_to_str(conn->src, pn, sizeof(pn)) : AF_UNSPEC) {
case AF_INET:
case AF_INET6:
@@ -3257,8 +3260,8 @@
&strm->si[0],
si_state_str(strm->si[0].state),
strm->si[0].flags,
- obj_type_name(strm->si[0].cs->end),
- obj_base_ptr(strm->si[0].cs->end),
+ obj_type_name(strm->csf->end),
+ obj_base_ptr(strm->csf->end),
strm->si[0].exp ?
tick_is_expired(strm->si[0].exp, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(strm->si[0].exp - now_ms),
@@ -3270,15 +3273,15 @@
&strm->si[1],
si_state_str(strm->si[1].state),
strm->si[1].flags,
- obj_type_name(strm->si[1].cs->end),
- obj_base_ptr(strm->si[1].cs->end),
+ obj_type_name(strm->csb->end),
+ obj_base_ptr(strm->csb->end),
strm->si[1].exp ?
tick_is_expired(strm->si[1].exp, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(strm->si[1].exp - now_ms),
TICKS_TO_MS(1000)) : "<NEVER>",
strm->si[1].err_type, strm->si[1].wait_event.events);
- cs = strm->si[0].cs;
+ cs = strm->csf;
chunk_appendf(&trash, " cs=%p csf=0x%08x ctx=%p\n", cs, cs->flags, cs->ctx);
if ((conn = cs_conn(cs)) != NULL) {
@@ -3314,7 +3317,7 @@
(unsigned long long)tmpctx->t->cpu_time, (unsigned long long)tmpctx->t->lat_time);
}
- cs = strm->si[1].cs;
+ cs = strm->csb;
chunk_appendf(&trash, " cs=%p csf=0x%08x ctx=%p\n", cs, cs->flags, cs->ctx);
if ((conn = cs_conn(cs)) != NULL) {
chunk_appendf(&trash,
@@ -3648,7 +3651,7 @@
human_time(TICKS_TO_MS(curr_strm->res.analyse_exp - now_ms),
TICKS_TO_MS(1000)) : "");
- conn = cs_conn(curr_strm->si[0].cs);
+ conn = cs_conn(curr_strm->csf);
chunk_appendf(&trash,
" s0=[%d,%1xh,fd=%d,ex=%s]",
curr_strm->si[0].state,
@@ -3658,7 +3661,7 @@
human_time(TICKS_TO_MS(curr_strm->si[0].exp - now_ms),
TICKS_TO_MS(1000)) : "");
- conn = cs_conn(curr_strm->si[1].cs);
+ conn = cs_conn(curr_strm->csb);
chunk_appendf(&trash,
" s1=[%d,%1xh,fd=%d,ex=%s]",
curr_strm->si[1].state,
diff --git a/src/tcp_sample.c b/src/tcp_sample.c
index d98f7c9..4a77036 100644
--- a/src/tcp_sample.c
+++ b/src/tcp_sample.c
@@ -54,7 +54,7 @@
if (kw[0] == 'b') { /* bc_src */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
- : (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
+ : (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_src(conn))
src = conn_src(conn);
}
@@ -98,7 +98,7 @@
if (kw[0] == 'b') { /* bc_src_port */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
- : (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
+ : (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_src(conn))
src = conn_src(conn);
}
@@ -133,7 +133,7 @@
if (kw[0] == 'b') { /* bc_dst */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
- : (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
+ : (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_dst(conn))
dst = conn_dst(conn);
}
@@ -229,7 +229,7 @@
if (kw[0] == 'b') { /* bc_dst_port */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
- : (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
+ : (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_dst(conn))
dst = conn_dst(conn);
}
@@ -325,7 +325,7 @@
/* get the object associated with the stream interface.The
* object can be other thing than a connection. For example,
* it be a appctx. */
- conn = cs_conn(smp->strm->si[dir].cs);
+ conn = (dir == 0 ? cs_conn(smp->strm->csf) : cs_conn(smp->strm->csb));
if (!conn)
return 0;