]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: stream: Save unprocessed events for a stream
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 8 Dec 2016 21:33:52 +0000 (22:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Dec 2016 18:10:58 +0000 (19:10 +0100)
commit9d810cae111991f1cd38d6ad37b4046c508884b8
treedd118cba8bb96844ca724857df9f8855d9e3c850
parent34c5cc98da7cad2c7e0733a7b86c8369d1dea5bd
BUG/MEDIUM: stream: Save unprocessed events for a stream

A stream can be awakened for different reasons. During its processing, it can be
early stopped if no buffer is available. In this situation, the reason why the
stream was awakened is lost, because we rely on the task state, which is reset
after each processing loop.

In many cases, that's not a big deal. But it can be useful to accumulate the
task states if the stream processing is interrupted, especially if some filters
need to be called.

To be clearer, here is an simple example:

  1) A stream is awakened with the reason TASK_WOKEN_MSG.

  2) Because no buffer is available, the processing is interrupted, the stream
  is back to sleep. And the task state is reset.

  3) Some buffers become available, so the stream is awakened with the reason
  TASK_WOKEN_RES. At this step, the previous reason (TASK_WOKEN_MSG) is lost.

Now, the task states are saved for a stream and reset only when the stream
processing is not interrupted. The correspoing bitfield represents the pending
events for a stream. And we use this one instead of the task state during the
stream processing.

Note that TASK_WOKEN_TIMER and TASK_WOKEN_RES are always removed because these
events are always handled during the stream processing.

[wt: backport to 1.7 and 1.6]
include/types/stream.h
src/stream.c