return __sc_strm(appctx->sedesc->sc);
}
+/* The applet announces it has more data to deliver to the stream's input
+ * buffer.
+ */
+static inline void applet_have_more_data(struct appctx *appctx)
+{
+ se_fl_clr(appctx->sedesc, SE_FL_RX_WAIT_EP);
+}
+
+/* The applet announces it doesn't have more data for the stream's input
+ * buffer.
+ */
+static inline void applet_have_no_more_data(struct appctx *appctx)
+{
+ se_fl_set(appctx->sedesc, SE_FL_RX_WAIT_EP);
+}
+
/* writes chunk <chunk> into the input channel of the stream attached to this
* appctx's endpoint, and marks the RXBLK_ROOM on a channel full error. See
* ci_putchk() for the list of return codes.
return !sc_ep_test(cs, SE_FL_RX_WAIT_EP);
}
-/* The stream connector announces it is ready to try to deliver more data to the input buffer */
-static inline void cs_rx_endp_more(struct stconn *cs)
+/* The stream endpoint announces it has more data to deliver to the stream's
+ * input buffer.
+ */
+static inline void se_have_more_data(struct sedesc *se)
{
- sc_ep_clr(cs, SE_FL_RX_WAIT_EP);
+ se_fl_clr(se, SE_FL_RX_WAIT_EP);
}
-/* The stream connector announces it doesn't have more data for the input buffer */
-static inline void cs_rx_endp_done(struct stconn *cs)
+/* The stream endpoint announces it doesn't have more data for the stream's
+ * input buffer.
+ */
+static inline void se_have_no_more_data(struct sedesc *se)
{
- sc_ep_set(cs, SE_FL_RX_WAIT_EP);
+ se_fl_set(se, SE_FL_RX_WAIT_EP);
}
/* The application layer informs a stream connector that it's willing to
* that one applet which ignores any event will not spin.
*/
cs_cant_get(cs);
- cs_rx_endp_done(cs);
+ applet_have_no_more_data(app);
/* Now we'll try to allocate the input buffer. We wake up the applet in
* all cases. So this is the applet's responsibility to check if this
* do if it needs the buffer, it will be called again upon readiness.
*/
if (!cs_alloc_ibuf(cs, &app->buffer_wait))
- cs_rx_endp_more(cs);
+ applet_have_more_data(app);
count = co_data(sc_oc(cs));
app->applet->fct(app);
else if (!cs_rx_blocked(cs) && !(ic->flags & CF_SHUTR)) {
/* Subscribe to receive events if we're blocking on I/O */
conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
- cs_rx_endp_done(cs);
+ se_have_no_more_data(cs->sedesc);
} else {
- cs_rx_endp_more(cs);
+ se_have_more_data(cs->sedesc);
ret = 1;
}
return ret;
* begin blocked by the channel.
*/
if (cs_rx_blocked(cs) || sc_ep_test(cs, SE_FL_APPLET_NEED_CONN))
- cs_rx_endp_more(cs);
+ applet_have_more_data(__sc_appctx(cs));
/* update the stream connector, channels, and possibly wake the stream up */
cs_notify(cs);
if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs);
se_need_remote_conn(appctx->sedesc);
- cs_rx_endp_more(cs);
+ applet_have_more_data(appctx);
return;
}
BUG_ON(LIST_INLIST(&appctx->wait_entry));
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
HA_RWLOCK_WRUNLOCK(DNS_LOCK, &ring->lock);
- cs_rx_endp_done(cs);
+ applet_have_no_more_data(appctx);
}
read:
spoe_wakeup_appctx(struct appctx *appctx)
{
cs_want_get(appctx_cs(appctx));
- cs_rx_endp_more(appctx_cs(appctx));
+ applet_have_more_data(appctx);
appctx_wakeup(appctx);
return 1;
}
if (!cs_state_in(cs->state, SC_SB_RDY|SC_SB_EST)) {
/* not connected yet */
- cs_rx_endp_more(cs);
+ applet_have_more_data(appctx);
task_wakeup(__sc_strm(cs)->task, TASK_WOKEN_MSG);
goto stop;
}
if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs);
se_need_remote_conn(appctx->sedesc);
- cs_rx_endp_more(cs);
+ applet_have_more_data(appctx);
return;
}
* to write, so we clear the blocking flag.
*/
if (notification_registered(&ctx->wake_on_write))
- cs_rx_endp_more(cs);
+ applet_have_more_data(appctx);
}
static int hlua_socket_init(struct appctx *appctx)
* connection completes.
*/
cs_cant_get(s->scf);
- cs_rx_endp_more(s->scf);
+ applet_have_more_data(appctx);
appctx_wakeup(appctx);
hlua->gc_count++;
/* Wakeup the applet ASAP. */
cs_cant_get(cs);
- cs_rx_endp_more(cs);
+ applet_have_more_data(ctx);
return 0;
}
if (!finished) {
/* let's come back later */
- cs_rx_endp_more(appctx_cs(appctx));
+ applet_have_more_data(appctx);
return 0;
}
return 1;
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);
- cs_rx_endp_done(cs);
+ applet_have_no_more_data(appctx);
ret = 0;
}
/* always drain all the request */
if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs);
se_need_remote_conn(appctx->sedesc);
- cs_rx_endp_more(cs);
+ applet_have_more_data(appctx);
return;
}
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);
- cs_rx_endp_done(cs);
+ applet_have_no_more_data(appctx);
}
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs);
se_need_remote_conn(appctx->sedesc);
- cs_rx_endp_more(cs);
+ applet_have_more_data(appctx);
return;
}
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);
- cs_rx_endp_done(cs);
+ applet_have_no_more_data(appctx);
}
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
/* store the state */
applet_putchk(appctx, trash);
free_trash_chunk(trash);
- cs_rx_endp_more(cs); /* let's come back later */
+ applet_have_more_data(appctx); /* let's come back later */
return 0; /* should come back */
error:
/* store the state */
applet_putchk(appctx, trash);
free_trash_chunk(trash);
- cs_rx_endp_more(cs); /* let's come back later */
+ applet_have_more_data(appctx); /* let's come back later */
return 0; /* should come back */
error:
/* store the state */
applet_putchk(appctx, trash);
free_trash_chunk(trash);
- cs_rx_endp_more(cs); /* let's come back later */
+ applet_have_more_data(appctx); /* let's come back later */
return 0; /* should come back */
error:
rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana;
- cs_rx_endp_more(s->scb);
+ se_have_more_data(s->scb->sedesc);
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
if (conn) {
/* real connections have timeouts
conn = sc_conn(cs);
if (conn) {
- cs_rx_endp_more(s->scf);
+ se_have_more_data(s->scf->sedesc);
/* Make sure we're unsubscribed, the the new
* mux will probably want to subscribe to
* the underlying XPRT