se_fl_clr(appctx->sedesc, SE_FL_WILL_CONSUME);
}
+/* The applet indicates that it's willing to consume data from the stream's
+ * output buffer, but that there's not enough, so it doesn't want to be woken
+ * up until more are presented.
+ */
+static inline void applet_need_more_data(struct appctx *appctx)
+{
+ se_fl_set(appctx->sedesc, SE_FL_WILL_CONSUME | SE_FL_WAIT_DATA);
+}
+
/* writes chunk <chunk> into the input channel of the stream attached to this
* appctx's endpoint, and marks the SC_FL_NEED_ROOM on a channel full error.
* See ci_putchk() for the list of return codes.
se_fl_clr(se, SE_FL_WILL_CONSUME);
}
-/* Report that a stream connector failed to get some data from the output buffer */
-static inline void cs_cant_get(struct stconn *cs)
+/* The stream endpoint indicates that it's willing to consume data from the
+ * stream's output buffer, but that there's not enough, so it doesn't want to
+ * be woken up until more are presented.
+ */
+static inline void se_need_more_data(struct sedesc *se)
{
- sc_ep_set(cs, SE_FL_WILL_CONSUME | SE_FL_WAIT_DATA);
+ se_fl_set(se, SE_FL_WILL_CONSUME | SE_FL_WAIT_DATA);
}
#endif /* _HAPROXY_CONN_STREAM_H */
* put, it's up to it to change this if needed. This ensures
* that one applet which ignores any event will not spin.
*/
- cs_cant_get(cs);
+ applet_need_more_data(app);
applet_have_no_more_data(app);
/* Now we'll try to allocate the input buffer. We wake up the applet in
return NULL;
cs_attach_applet(cs, appctx);
appctx->t->nice = __sc_strm(cs)->task->nice;
- cs_cant_get(cs);
+ applet_need_more_data(appctx);
appctx_wakeup(appctx);
cs->state = SC_ST_RDY;
* to be notified whenever the connection completes.
*/
if (cs_opposite(cs)->state < SC_ST_EST) {
- cs_cant_get(cs);
+ applet_need_more_data(appctx);
se_need_remote_conn(appctx->sedesc);
applet_have_more_data(appctx);
return;
stream_set_backend(s, agent->b.be);
/* applet is waiting for data */
- cs_cant_get(s->scf);
+ applet_need_more_data(appctx);
s->do_log = NULL;
s->res.flags |= CF_READ_DONTWAIT;
* to be notified whenever the connection completes.
*/
if (cs_opposite(cs)->state < SC_ST_EST) {
- cs_cant_get(cs);
+ applet_need_more_data(appctx);
se_need_remote_conn(appctx->sedesc);
applet_have_more_data(appctx);
return;
/* inform the stream that we want to be notified whenever the
* connection completes.
*/
- cs_cant_get(s->scf);
+ applet_need_more_data(appctx);
applet_have_more_data(appctx);
appctx_wakeup(appctx);
/* Data not yet available. return yield. */
if (ret == 0) {
- cs_cant_get(cs);
+ applet_need_more_data(luactx->appctx);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_getline_yield, TICK_ETERNITY, 0));
}
/* Data not yet available. return yield. */
if (ret == 0) {
- cs_cant_get(cs);
+ applet_need_more_data(luactx->appctx);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
}
luaL_addlstring(&luactx->b, blk1, len1);
luaL_addlstring(&luactx->b, blk2, len2);
co_skip(sc_oc(cs), len1 + len2);
- cs_cant_get(cs);
+ applet_need_more_data(luactx->appctx);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
} else {
if (len > 0) {
lua_pushinteger(L, len);
lua_replace(L, 2);
- cs_cant_get(cs);
+ applet_need_more_data(luactx->appctx);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
}
htx_to_buf(htx, &req->buf);
if (!stop) {
- cs_cant_get(cs);
+ applet_need_more_data(luactx->appctx);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_getline_yield, TICK_ETERNITY, 0));
}
lua_pushinteger(L, len);
lua_replace(L, 2);
}
- cs_cant_get(cs);
+ applet_need_more_data(luactx->appctx);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_recv_yield, TICK_ETERNITY, 0));
}
RESET_SAFE_LJMP(hlua);
/* Wakeup the applet ASAP. */
- cs_cant_get(cs);
+ applet_need_more_data(ctx);
applet_have_more_data(ctx);
return 0;
RESET_SAFE_LJMP(hlua);
/* Wakeup the applet when data is ready for read. */
- cs_cant_get(cs);
+ applet_need_more_data(ctx);
return 0;
}
if (!HLUA_IS_RUNNING(hlua) &&
!(http_ctx->flags & APPLET_DONE)) {
if (!co_data(req)) {
- cs_cant_get(cs);
+ applet_need_more_data(ctx);
goto out;
}
}
s->res.flags |= CF_READ_DONTWAIT;
/* applet is waiting for data */
- cs_cant_get(s->scf);
+ applet_need_more_data(appctx);
appctx_wakeup(appctx);
hc->appctx = appctx;
s = appctx_strm(appctx);
/* applet is waiting for data */
- cs_cant_get(s->scf);
+ applet_need_more_data(appctx);
appctx_wakeup(appctx);
/* initiate an outgoing connection */
* to be notified whenever the connection completes.
*/
if (cs_opposite(cs)->state < SC_ST_EST) {
- cs_cant_get(cs);
+ applet_need_more_data(appctx);
se_need_remote_conn(appctx->sedesc);
applet_have_more_data(appctx);
return;
* to be notified whenever the connection completes.
*/
if (cs_opposite(cs)->state < SC_ST_EST) {
- cs_cant_get(cs);
+ applet_need_more_data(appctx);
se_need_remote_conn(appctx->sedesc);
applet_have_more_data(appctx);
return;
}
/* Now we can schedule the applet. */
- cs_cant_get(s->scb);
+ applet_need_more_data(appctx);
appctx_wakeup(appctx);
return ACT_RET_STOP;
}