MINOR: listener: resync with the thread index before heavy calculations
authorWilly Tarreau <w@1wt.eu>
Wed, 19 Apr 2023 15:19:28 +0000 (17:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 21 Apr 2023 15:41:26 +0000 (17:41 +0200)
commit77e33509c8603b67340f9d754b16b1fbaec7ac15
treee9d23f851e872c5c9a726442f6d94b2308916bb9
parentb65749268053bb8a77dcb4ec7c878f81156ac351
MINOR: listener: resync with the thread index before heavy calculations

During heavy accept competition, the CAS will occasionally fail and
we'll have to go through all the calculation again. While the first
two loops look heavy, they're almost never taken so they're quite
cheap. However the rest of the operation is heavy because we have to
consult connection counts and queue indexes for other threads, so
better double-check if the index is still valid before continuing.
Tests show that it's more efficient do retry half-way like this.
src/listener.c