mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
This lock was necessary to manipulate the pendconn element between concurrent places, but was causing great difficulties in the list walk by having to iterate over multiple entries instead of being able to safely pick the first one (in fact the first element was always the right one but the locking model was hard to prove). Here since we know we can always rely on the queue's locks, we take the queue's lock every time we need to modify the element. In practice it was already the case everywhere except in pendconn_dequeue() which only works on an element that was already detached. This function had to be protected against the risk of meeting an incompletely detached element (which could be unlinked but not yet assigned). By taking the queue lock around the LIST_ISEMPTY test, it's enough to ensure that a concurrent thread either didn't begin or had completed the operation. The true benefit really is in pendconn_process_next_strm() where we can again safely work with the first element of each queue. This will significantly simplify next updates to this code.