__FUNCTION__,
si, si->state, ic->flags, si_oc(si)->flags);
- if (!channel_may_recv(ic) || ic->pipe) {
+ if (ic->pipe) {
/* stop reading */
si->flags |= SI_FL_WAIT_ROOM;
}
/* indicate that we may be waiting for data from the output channel or
* we're about to close and can't expect more data if SHUTW_NOW is there.
*/
- if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0 && channel_may_recv(oc))
+ if (!(oc->flags & (CF_SHUTW|CF_SHUTW_NOW)))
si->flags |= SI_FL_WAIT_DATA;
else if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW)
si->flags &= ~SI_FL_WAIT_DATA;
ic->rex = tick_add_ifset(now_ms, ic->rto);
if (likely((oc->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL &&
- channel_may_recv(oc) &&
- (si_opposite(si)->flags & SI_FL_WAIT_ROOM))) {
+ (si_opposite(si)->flags & SI_FL_WAIT_ROOM))) {
si_opposite(si)->flags &= ~SI_FL_WAIT_ROOM;
si_chk_rcv(si_opposite(si));
}
/* check if the consumer has freed some space either in the
* buffer or in the pipe.
*/
- if (channel_may_recv(ic) && new_len < last_len) {
+ if (new_len < last_len) {
si->flags &= ~SI_FL_WAIT_ROOM;
si_chk_rcv(si);
}
if (si->flags & SI_FL_WAIT_ROOM) {
ic->rex = TICK_ETERNITY;
}
- else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL|CF_DONT_READ)) == CF_READ_PARTIAL &&
- channel_may_recv(ic)) {
+ else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL|CF_DONT_READ)) == CF_READ_PARTIAL) {
/* we must re-enable reading if si_chk_snd() has freed some space */
if (!(ic->flags & CF_READ_NOEXP) && tick_isset(ic->rex))
ic->rex = tick_add_ifset(now_ms, ic->rto);
si_want_put(si);
/* Read not closed, update FD status and timeout for reads */
- if ((ic->flags & CF_DONT_READ) || !channel_may_recv(ic)) {
+ if ((ic->flags & CF_DONT_READ) || co_data(ic)) {
/* stop reading */
- if (!(si->flags & SI_FL_WAIT_ROOM)) {
- if (!(ic->flags & CF_DONT_READ)) /* full */
- si_cant_put(si);
- ic->rex = TICK_ETERNITY;
- }
+ si_stop_put(si);
+ ic->rex = TICK_ETERNITY;
}
- else if (!(si->flags & SI_FL_WAIT_ROOM) || !co_data(ic)) {
+ else {
/* (re)start reading and update timeout. Note: we don't recompute the timeout
* everytime we get here, otherwise it would risk never to expire. We only
* update it if is was not yet set. The stream socket handler will already
*/
static void stream_int_chk_rcv_conn(struct stream_interface *si)
{
- struct channel *ic = si_ic(si);
-
- if (!channel_may_recv(ic)) {
- /* stop reading */
- si->flags |= SI_FL_WAIT_ROOM;
- }
- else {
- /* (re)start reading */
- tasklet_wakeup(si->wait_event.task);
- }
+ /* (re)start reading */
+ tasklet_wakeup(si->wait_event.task);
}
ic->flags |= CF_READ_PARTIAL;
ic->total += ret;
- if (!channel_may_recv(ic)) {
- si_cant_put(si);
- break;
- }
-
if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0)
break;
if (ret >= global.tune.recv_enough)
break;
}
+
+ /* if we are waiting for more space, don't try to read more data
+ * right now.
+ */
+ if (si->flags & SI_FL_WAIT_ROOM)
+ break;
} /* while !flags */
if (cur_read) {
__FUNCTION__,
si, si->state, ic->flags, si_oc(si)->flags);
- if (channel_may_recv(ic) && !ic->pipe) {
+ if (!ic->pipe) {
/* (re)start reading */
appctx_wakeup(si_appctx(si));
}