MEDIUM: stream: don't try to send first in process_stream()

The rationale here is that we should never need to try to send() at the
beginning of process_stream() because :
  - if something was pending, it's very unlikely that it was unblocked
    and not sent just between the last poll() and the wakeup instant.
  - if something pending was recently sent, then we don't have anything
    to send anymore.

So at first glance it doesn't seem like there could be any valid case
where trying to send before entering the function brings any benefit.
This commit is contained in:
Willy Tarreau 2018-10-25 10:42:39 +02:00
parent 18e066c2e7
commit 0f8d3ab362

View File

@ -1669,25 +1669,16 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
si_f = &s->si[0];
si_b = &s->si[1];
/* First, attempd to do I/Os */
/* First, attempt to receive pending data from I/O layers */
cs = objt_cs(si_f->end);
if (cs) {
if (!(si_f->wait_event.wait_reason & SUB_CAN_SEND) &&
co_data(si_oc(si_f)))
si_cs_send(cs);
if (!(si_f->wait_event.wait_reason & SUB_CAN_RECV) &&
(!(si_f->flags & SI_FL_WAIT_ROOM) || !c_size(req)))
si_cs_recv(cs);
}
cs = objt_cs(si_b->end);
if (cs) {
if (!(si_b->wait_event.wait_reason & SUB_CAN_SEND) &&
co_data(si_oc(si_b)))
si_cs_send(cs);
if (!(si_b->wait_event.wait_reason & SUB_CAN_RECV) &&
(!(si_b->flags & SI_FL_WAIT_ROOM) || !c_size(res)))
if (cs && !(si_f->wait_event.wait_reason & SUB_CAN_RECV) &&
(!(si_f->flags & SI_FL_WAIT_ROOM) || !c_size(req)))
si_cs_recv(cs);
cs = objt_cs(si_b->end);
if (cs && !(si_b->wait_event.wait_reason & SUB_CAN_RECV) &&
(!(si_b->flags & SI_FL_WAIT_ROOM) || !c_size(res)))
si_cs_recv(cs);
}
redo:
//DPRINTF(stderr, "%s:%d: cs=%d ss=%d(%d) rqf=0x%08x rpf=0x%08x\n", __FUNCTION__, __LINE__,