/* Report that a stream interface failed to put some data into the input buffer */
static inline void si_cant_put(struct stream_interface *si)
{
- si->flags |= SI_FL_WANT_PUT | SI_FL_WAIT_ROOM;
+ si->flags |= SI_FL_WANT_PUT | SI_FL_RXBLK_ROOM;
}
/* Report that a stream interface doesn't want to put data into the input buffer */
/* Report that a stream interface won't put any more data into the input buffer */
static inline void si_done_put(struct stream_interface *si)
{
- si->flags &= ~(SI_FL_WANT_PUT | SI_FL_WAIT_ROOM);
+ si->flags &= ~(SI_FL_WANT_PUT | SI_FL_RXBLK_ROOM);
}
/* Report that a stream interface wants to get some data from the output buffer */
* channel_alloc_buffer() for this so it abides by its rules. It returns 0 on
* failure, non-zero otherwise. If no buffer is available, the requester,
* represented by <wait> pointer, will be added in the list of objects waiting
- * for an available buffer, and SI_FL_WAIT_ROOM will be set on the stream-int.
+ * for an available buffer, and SI_FL_RXBLK_ROOM will be set on the stream-int.
* The requester will be responsible for calling this function to try again
* once woken up.
*/
}
/* This is to be used after making some room available in a channel. It will
- * return without doing anything if {SI_FL_WANT_PUT,SI_FL_WAIT_ROOM} != {1,0}.
+ * return without doing anything if {SI_FL_WANT_PUT,SI_FL_RXBLK_ROOM} != {1,0}.
* It will then call ->chk_rcv() to enable receipt of new data.
*/
static inline void si_chk_rcv(struct stream_interface *si)
{
- if (si->flags & SI_FL_WAIT_ROOM)
+ if (si->flags & SI_FL_RXBLK_ROOM)
return;
if (!(si->flags & SI_FL_WANT_PUT))
if (si->wait_event.wait_reason & SUB_CAN_RECV)
return 0; // already subscribed
- if (si->flags & SI_FL_WAIT_ROOM && c_size(si_ic(si)))
+ if (si->flags & SI_FL_RXBLK_ROOM && c_size(si_ic(si)))
return 0; // already failed
return si_cs_recv(cs);
/* Callback used to wake up a stream when an input buffer is available. The
* stream <s>'s stream interfaces are checked for a failed buffer allocation
- * as indicated by the presence of the SI_FL_WAIT_ROOM flag and the lack of a
+ * as indicated by the presence of the SI_FL_RXBLK_ROOM flag and the lack of a
* buffer, and and input buffer is assigned there (at most one). The function
* returns 1 and wakes the stream up if a buffer was taken, otherwise zero.
* It's designed to be called from __offer_buffer().
{
struct stream *s = arg;
- if (!s->req.buf.size && !s->req.pipe && (s->si[0].flags & SI_FL_WAIT_ROOM) &&
+ if (!s->req.buf.size && !s->req.pipe && (s->si[0].flags & SI_FL_RXBLK_ROOM) &&
b_alloc_margin(&s->req.buf, global.tune.reserved_bufs))
- s->si[0].flags &= ~SI_FL_WAIT_ROOM;
- else if (!s->res.buf.size && !s->res.pipe && (s->si[1].flags & SI_FL_WAIT_ROOM) &&
+ s->si[0].flags &= ~SI_FL_RXBLK_ROOM;
+ else if (!s->res.buf.size && !s->res.pipe && (s->si[1].flags & SI_FL_RXBLK_ROOM) &&
b_alloc_margin(&s->res.buf, 0))
- s->si[1].flags &= ~SI_FL_WAIT_ROOM;
+ s->si[1].flags &= ~SI_FL_RXBLK_ROOM;
else
return 0;
/* Note that none of these states may happen with applets */
si->state = SI_ST_DIS;
default:
- si->flags &= ~(SI_FL_WAIT_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
+ si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
if (ic->pipe) {
/* stop reading */
- si->flags |= SI_FL_WAIT_ROOM;
+ si->flags |= SI_FL_RXBLK_ROOM;
}
else {
/* (re)start reading */
* layers (applets, connections) after I/O completion. After updating the stream
* interface and timeouts, it will try to forward what can be forwarded, then to
* wake the associated task up if an important event requires special handling.
- * It may update SI_FL_WAIT_DATA and/or SI_FL_WAIT_ROOM, that the callers are
+ * It may update SI_FL_WAIT_DATA and/or SI_FL_RXBLK_ROOM, that the callers are
* encouraged to watch to take appropriate action.
* It should not be called from within the stream itself, stream_int_update()
* is designed for this.
ic->rex = tick_add_ifset(now_ms, ic->rto);
}
- if ((si_opposite(si)->flags & SI_FL_WAIT_ROOM) &&
+ if ((si_opposite(si)->flags & SI_FL_RXBLK_ROOM) &&
((oc->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL ||
channel_is_empty(oc))) {
- si_opposite(si)->flags &= ~SI_FL_WAIT_ROOM;
+ si_opposite(si)->flags &= ~SI_FL_RXBLK_ROOM;
si_chk_rcv(si_opposite(si));
}
* are output data, but we avoid doing this if some of the data are
* not yet scheduled for being forwarded, because it is very likely
* that it will be done again immediately afterwards once the following
- * data are parsed (eg: HTTP chunking). We only SI_FL_WAIT_ROOM once
+ * data are parsed (eg: HTTP chunking). We only SI_FL_RXBLK_ROOM once
* we've emptied *some* of the output buffer, and not just when there
* is available room, because applets are often forced to stop before
* the buffer is full. We must not stop based on input data alone because
* buffer or in the pipe.
*/
if (new_len < last_len) {
- si->flags &= ~SI_FL_WAIT_ROOM;
+ si->flags &= ~SI_FL_RXBLK_ROOM;
si_chk_rcv(si);
}
}
- if (si->flags & SI_FL_WAIT_ROOM) {
+ if (si->flags & SI_FL_RXBLK_ROOM) {
ic->rex = TICK_ETERNITY;
}
else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL|CF_DONT_READ)) == CF_READ_PARTIAL) {
* update it if is was not yet set. The stream socket handler will already
* have updated it if there has been a completed I/O.
*/
- si->flags &= ~SI_FL_WAIT_ROOM;
+ si->flags &= ~SI_FL_RXBLK_ROOM;
si_chk_rcv(si);
if (!(ic->flags & (CF_READ_NOEXP|CF_DONT_READ)) && !tick_isset(ic->rex))
ic->rex = tick_add_ifset(now_ms, ic->rto);
!(cs->flags & CS_FL_ERROR) &&
!(cs->conn->flags & CO_FL_ERROR)) {
if (si_cs_send(cs))
- si_b->flags &= ~SI_FL_WAIT_ROOM;
+ si_b->flags &= ~SI_FL_RXBLK_ROOM;
}
/* back stream-int */
!(cs->flags & CS_FL_ERROR) &&
!(cs->conn->flags & CO_FL_ERROR)) {
if (si_cs_send(cs))
- si_f->flags &= ~SI_FL_WAIT_ROOM;
+ si_f->flags &= ~SI_FL_RXBLK_ROOM;
}
/* it's time to try to receive */
* handled at the latest moment.
*/
if (obj_type(si_f->end) == OBJ_TYPE_APPCTX &&
- (((si_f->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) ||
+ (((si_f->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) ||
((si_f->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
appctx_wakeup(si_appctx(si_f));
if (obj_type(si_b->end) == OBJ_TYPE_APPCTX &&
- (((si_b->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) ||
+ (((si_b->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) ||
((si_b->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
appctx_wakeup(si_appctx(si_b));
}
si->state = SI_ST_DIS;
/* fall through */
default:
- si->flags &= ~(SI_FL_WAIT_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
+ si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
/* if we are waiting for more space, don't try to read more data
* right now.
*/
- if (si->flags & SI_FL_WAIT_ROOM)
+ if (si->flags & SI_FL_RXBLK_ROOM)
break;
} /* while !flags */
goto out_shutdown_r;
/* Subscribe to receive events */
- if (!(si->flags & SI_FL_WAIT_ROOM))
+ if (!(si->flags & SI_FL_RXBLK_ROOM))
conn->mux->subscribe(cs, SUB_CAN_RECV, &si->wait_event);
- return (cur_read != 0 || (si->flags & SI_FL_WAIT_ROOM));
+ return (cur_read != 0 || (si->flags & SI_FL_RXBLK_ROOM));
out_shutdown_r:
/* we received a shutdown */
* we may have to wakeup the appctx immediately.
*/
if (!task_in_rq(si_task(si)) &&
- (((si->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) ||
+ (((si->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) ||
((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
appctx_wakeup(si_appctx(si));
}
si_applet_release(si);
si->state = SI_ST_DIS;
default:
- si->flags &= ~(SI_FL_WAIT_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
+ si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;