]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stream: Map task wake up reasons to dedicated stream events
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Jan 2025 17:38:40 +0000 (18:38 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Jan 2025 13:53:37 +0000 (14:53 +0100)
commit6048460102c9c364872198554dc737a45df2f611
treeaf6a6b373decc9b8cce928a8e2905cda1a1fe35a
parent0a52a75ef7151a187b42cae6d49a75b79380f211
MEDIUM: stream: Map task wake up reasons to dedicated stream events

To fix thread-safety issues when a stream must be shut, three new task
states were added. These states are generic (UEVT1, UEVT2 and UEVT3), the
task callback function is responsible to know what to do with them. However,
it is not really scalable.

The best is to use an atomic field in the stream structure itself to deal
with these dedicated events. There is already the "pending_events" field
that save wake up reasons (TASK_WOKEN_*) to not loose them if
process_stream() is interrupted before it had a chance to handle them.

So the idea is to introduce a new field to handle streams dedicated events
and merged them with the task's wake up reasons used by the stream. This
means a mapping must be performed between some task wake up reasons and
streams events. Note that not all task wake up reasons will be mapped.

In this patch, the "new_events" field is introduced. It is an atomic
bit-field. Streams events (STRM_EVT_*) are also introduced to map the task
wake up reasons used by process_stream(). Only TASK_WOKEN_TIMER and
TASK_WOKEN_MSG are mapped, in addition to TASK_F_UEVT* flags. In
process_stream(), "pending_events" field is now filled with new stream
events and the mapping of the wake up reasons.
addons/ot/src/filter.c
include/haproxy/stream-t.h
include/haproxy/stream.h
src/flt_spoe.c
src/stream.c