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.
This commit is contained in:
Willy Tarreau 2022-05-10 11:32:31 +02:00
parent 15b0721ca5
commit 66435e5f63
7 changed files with 9 additions and 9 deletions

View File

@ -1563,8 +1563,8 @@ static void promex_appctx_handle_io(struct appctx *appctx)
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 */

View File

@ -106,7 +106,7 @@ int appctx_buf_available(void *arg)
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 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
/* 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

View File

@ -1524,8 +1524,8 @@ static void http_cache_io_handler(struct appctx *appctx)
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;
}

View File

@ -1108,7 +1108,7 @@ static void cli_io_handler(struct appctx *appctx)
}
break;
default: /* abnormal state */
cs->endp->flags |= CS_EP_ERROR;
appctx->endp->flags |= CS_EP_ERROR;
break;
}

View File

@ -9629,8 +9629,8 @@ void hlua_applet_http_fct(struct appctx *ctx)
}
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;
}

View File

@ -832,8 +832,8 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
/* 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;
}

View File

@ -4348,8 +4348,8 @@ static void http_stats_io_handler(struct appctx *appctx)
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;
}