]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: ring: move the ring reader code to ring_dispatch_messages()
authorWilly Tarreau <w@1wt.eu>
Tue, 27 Feb 2024 15:54:18 +0000 (16:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2024 17:34:19 +0000 (17:34 +0000)
commitc62a2d540d2de0deaedd7822d68baea843a818aa
tree84d7a07f8e92a80f4882d193daa8e6028e30ed21
parentad31e5328740a1f7d418a74bdab17f7cea290579
MEDIUM: ring: move the ring reader code to ring_dispatch_messages()

This new function is made around the loop that scans a ring for new
messages and dispatches them to a message handler. It also takes
ring flags (WAIT, NEW, etc) and offset pointers that the caller will
use to initialize/reuse/update the current processing offset. The
caller is still responsible for presetting it to ~0 before the
first call if it wants the function to automatically adjust it (or set
it to the correct value). The function may also return the last_ofs
that was known before releasing the lock so that the caller knows
what to compare against and if it needs to restart processing or not.
The context remains a void* so that should not necessarily depend on
an appctx.

The current "show ring" code was ported to this and it continues to
work as expected.
include/haproxy/ring.h
src/ring.c