}
}
+/* returns the stconn associated to the FCGI stream */
+static forceinline struct stconn *fcgi_strm_sc(const struct fcgi_strm *fstrm)
+{
+ return fstrm->endp->cs;
+}
+
/* the FCGI traces always expect that arg1, if non-null, is of type connection
* (from which we can derive fconn), that arg2, if non-null, is of type fstrm,
}
if ((fconn->flags & FCGI_CF_DEM_SALLOC) &&
- (fstrm = fcgi_conn_st_by_id(fconn, fconn->dsi)) && fstrm->endp->cs &&
+ (fstrm = fcgi_conn_st_by_id(fconn, fconn->dsi)) && fcgi_strm_sc(fstrm) &&
b_alloc(&fstrm->rxbuf)) {
TRACE_STATE("unblocking fstrm, rxbuf allocated", FCGI_EV_STRM_RECV|FCGI_EV_FSTRM_BLK|FCGI_EV_STRM_WAKE, fconn->conn, fstrm);
fconn->flags &= ~FCGI_CF_DEM_SALLOC;
fcgi_strm_notify_recv(fstrm);
fcgi_strm_notify_send(fstrm);
}
- else if (fstrm->endp->cs && fstrm->endp->cs->data_cb->wake != NULL) {
+ else if (fcgi_strm_sc(fstrm) && fcgi_strm_sc(fstrm)->data_cb->wake != NULL) {
TRACE_POINT(FCGI_EV_STRM_WAKE, fstrm->fconn->conn, fstrm);
- fstrm->endp->cs->data_cb->wake(fstrm->endp->cs);
+ fcgi_strm_sc(fstrm)->data_cb->wake(fcgi_strm_sc(fstrm));
}
}
fstrm->fconn->nb_streams--;
if (!fstrm->id)
fstrm->fconn->nb_reserved--;
- if (fstrm->endp->cs) {
+ if (fcgi_strm_sc(fstrm)) {
if (!se_fl_test(fstrm->endp, SE_FL_EOS) && !b_data(&fstrm->rxbuf))
fcgi_strm_notify_recv(fstrm);
}
TRACE_ENTER(FCGI_EV_STRM_WAKE, fconn->conn, fstrm);
- if (!fstrm->endp->cs) {
+ if (!fcgi_strm_sc(fstrm)) {
/* this stream was already orphaned */
fcgi_strm_destroy(fstrm);
TRACE_DEVEL("leaving with no fstrm", FCGI_EV_STRM_WAKE, fconn->conn);
struct fcgi_strm_params *params)
{
struct connection *cli_conn = objt_conn(fstrm->sess->origin);
- const struct sockaddr_storage *src = (cs_check(fstrm->endp->cs) ? conn_src(fconn->conn) : cs_src(cs_opposite(fstrm->endp->cs)));
- const struct sockaddr_storage *dst = (cs_check(fstrm->endp->cs) ? conn_dst(fconn->conn) : cs_dst(cs_opposite(fstrm->endp->cs)));
+ const struct sockaddr_storage *src = (cs_check(fcgi_strm_sc(fstrm)) ? conn_src(fconn->conn) : cs_src(cs_opposite(fcgi_strm_sc(fstrm))));
+ const struct sockaddr_storage *dst = (cs_check(fcgi_strm_sc(fstrm)) ? conn_dst(fconn->conn) : cs_dst(cs_opposite(fcgi_strm_sc(fstrm))));
struct ist p;
if (!sl)
/* Only FCGI_CS_RECORD_D or FCGI_CS_RECORD_P */
tmp_fstrm = fcgi_conn_st_by_id(fconn, fconn->dsi);
- if (tmp_fstrm != fstrm && fstrm && fstrm->endp->cs &&
+ if (tmp_fstrm != fstrm && fstrm && fcgi_strm_sc(fstrm) &&
(b_data(&fstrm->rxbuf) ||
fcgi_conn_read0_pending(fconn) ||
fstrm->state == FCGI_SS_CLOSED ||
fail:
/* we can go here on missing data, blocked response or error */
- if (fstrm && fstrm->endp->cs &&
+ if (fstrm && fcgi_strm_sc(fstrm) &&
(b_data(&fstrm->rxbuf) ||
fcgi_conn_read0_pending(fconn) ||
fstrm->state == FCGI_SS_CLOSED ||
while (node) {
fstrm = container_of(node, struct fcgi_strm, by_id);
- if (fstrm->endp->cs && se_fl_test(fstrm->endp, SE_FL_WAIT_FOR_HS))
+ if (fcgi_strm_sc(fstrm) && se_fl_test(fstrm->endp, SE_FL_WAIT_FOR_HS))
fcgi_strm_notify_recv(fstrm);
node = eb32_next(node);
}
struct proxy *other_end;
union error_snapshot_ctx ctx;
- if (fstrm->endp->cs && cs_strm(fstrm->endp->cs)) {
+ if (fcgi_strm_sc(fstrm) && cs_strm(fcgi_strm_sc(fstrm))) {
if (sess == NULL)
- sess = __cs_strm(fstrm->endp->cs)->sess;
+ sess = __cs_strm(fcgi_strm_sc(fstrm))->sess;
if (!(h1m->flags & H1_MF_RESP))
- other_end = __cs_strm(fstrm->endp->cs)->be;
+ other_end = __cs_strm(fcgi_strm_sc(fstrm))->be;
else
other_end = sess->fe;
} else
node = eb32_first(&fconn->streams_by_id);
while (node) {
fstrm = container_of(node, struct fcgi_strm, by_id);
- if (fstrm->endp->cs)
- return fstrm->endp->cs;
+ if (fcgi_strm_sc(fstrm))
+ return fcgi_strm_sc(fstrm);
node = eb32_next(node);
}
return NULL;
/* We're done trying to send, remove ourself from the send_list */
LIST_DEL_INIT(&fstrm->send_list);
- if (!fstrm->endp->cs) {
+ if (!fcgi_strm_sc(fstrm)) {
fcgi_strm_destroy(fstrm);
if (fcgi_conn_is_dead(fconn))
fcgi_release(fconn);
while (node) {
fstrm = container_of(node, struct fcgi_strm, by_id);
tree_cnt++;
- if (!fstrm->endp->cs)
+ if (!fcgi_strm_sc(fstrm))
orph_cnt++;
node = eb32_next(node);
}
fstrm, fstrm->id, fstrm->flags,
(unsigned int)b_data(&fstrm->rxbuf), b_orig(&fstrm->rxbuf),
(unsigned int)b_head_ofs(&fstrm->rxbuf), (unsigned int)b_size(&fstrm->rxbuf),
- fstrm->endp->cs);
+ fcgi_strm_sc(fstrm));
if (fstrm->endp) {
chunk_appendf(msg, " .endp.flg=0x%08x", se_fl_get(fstrm->endp));
if (!se_fl_test(fstrm->endp, SE_FL_ORPHAN))
chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p",
- fstrm->endp->cs->flags, fstrm->endp->cs->app);
+ fcgi_strm_sc(fstrm)->flags, fcgi_strm_sc(fstrm)->app);
}
chunk_appendf(&trash, " .subs=%p", fstrm->subs);
if (fstrm->subs) {