CLEANUP: applet: use the appctx's endp instead of cs->endp
The few applets that set CS_EP_EOI or CS_EP_ERROR used to set it on the
endpoint retrieved from the conn_stream while it's already available on
the appctx itself. Better use the appctx one to limit the unneeded
interactions between the two sides.
diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c
index e247920..fb2fd9c 100644
--- a/addons/promex/service-prometheus.c
+++ b/addons/promex/service-prometheus.c
@@ -1563,8 +1563,8 @@
channel_add_input(res, 1);
}
res_htx->flags |= HTX_FL_EOM;
- cs->endp->flags |= CS_EP_EOI;
res->flags |= CF_EOI;
+ appctx->endp->flags |= CS_EP_EOI;
appctx->st0 = PROMEX_ST_END;
/* fall through */
diff --git a/src/applet.c b/src/applet.c
index 381c36e..9149af4 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -106,7 +106,7 @@
struct conn_stream *cs = appctx->owner;
/* allocation requested ? */
- if (!(cs->endp->flags & CS_EP_RXBLK_BUFF))
+ if (!(appctx->endp->flags & CS_EP_RXBLK_BUFF))
return 0;
cs_rx_buff_rdy(cs);
@@ -168,8 +168,8 @@
/* measure the call rate and check for anomalies when too high */
rate = update_freq_ctr(&app->call_rate, 1);
if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second
- ((b_size(cs_ib(cs)) && cs->endp->flags & CS_EP_RXBLK_BUFF) || // asks for a buffer which is present
- (b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && cs->endp->flags & CS_EP_RXBLK_ROOM) || // asks for room in an empty buffer
+ ((b_size(cs_ib(cs)) && app->endp->flags & CS_EP_RXBLK_BUFF) || // asks for a buffer which is present
+ (b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && app->endp->flags & CS_EP_RXBLK_ROOM) || // asks for room in an empty buffer
(b_data(cs_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present
(!b_data(cs_ib(cs)) && b_data(cs_ob(cs)) && // didn't return anything ...
(cs_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
diff --git a/src/cache.c b/src/cache.c
index f62aff8..2e5c5a4 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1524,8 +1524,8 @@
if (appctx->st0 == HTX_CACHE_EOM) {
/* no more data are expected. */
res_htx->flags |= HTX_FL_EOM;
- cs->endp->flags |= CS_EP_EOI;
res->flags |= CF_EOI;
+ appctx->endp->flags |= CS_EP_EOI;
appctx->st0 = HTX_CACHE_END;
}
diff --git a/src/cli.c b/src/cli.c
index 1618aae..30d24b8 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1108,7 +1108,7 @@
}
break;
default: /* abnormal state */
- cs->endp->flags |= CS_EP_ERROR;
+ appctx->endp->flags |= CS_EP_ERROR;
break;
}
diff --git a/src/hlua.c b/src/hlua.c
index 2327553..8d6fc35 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -9629,8 +9629,8 @@
}
res_htx->flags |= HTX_FL_EOM;
- cs->endp->flags |= CS_EP_EOI;
res->flags |= CF_EOI;
+ ctx->endp->flags |= CS_EP_EOI;
strm->txn->status = http_ctx->status;
http_ctx->flags |= APPLET_RSP_SENT;
}
diff --git a/src/http_client.c b/src/http_client.c
index 5d22044..bff7057 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -832,8 +832,8 @@
/* if the request contains the HTX_FL_EOM, we finished the request part. */
if (htx->flags & HTX_FL_EOM) {
- cs->endp->flags |= CS_EP_EOI;
req->flags |= CF_EOI;
+ appctx->endp->flags |= CS_EP_EOI;
appctx->st0 = HTTPCLIENT_S_RES_STLINE;
}
diff --git a/src/stats.c b/src/stats.c
index bd73f48..aef9bac 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -4348,8 +4348,8 @@
channel_add_input(res, 1);
}
res_htx->flags |= HTX_FL_EOM;
- cs->endp->flags |= CS_EP_EOI;
res->flags |= CF_EOI;
+ appctx->endp->flags |= CS_EP_EOI;
appctx->st0 = STAT_HTTP_END;
}