MINOR: listener: make accept_queue index atomic
authorWilly Tarreau <w@1wt.eu>
Thu, 20 Apr 2023 09:05:28 +0000 (11:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 21 Apr 2023 15:41:26 +0000 (17:41 +0200)
commite6f5ab5afa1e11d509aa92588b64de6e3d3765a8
treea321df72c3c89aa155072e69d911fcd031999592
parent09b52d1c3de809a030061db0d4335f31dd2f4bdd
MINOR: listener: make accept_queue index atomic

There has always been a race when checking the length of an accept queue
to determine which one is more loaded that another, because the head and
tail are read at two different moments. This is not required, we can merge
them as two 16 bit numbers inside a single 32-bit index that is always
accessed atomically. This way we read both values at once and always have
a consistent measurement.
include/haproxy/listener-t.h
include/haproxy/listener.h
src/activity.c
src/listener.c