]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: ring: fix the way watchers are counted
authorWilly Tarreau <w@1wt.eu>
Fri, 30 Aug 2019 08:16:14 +0000 (10:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 30 Aug 2019 09:58:58 +0000 (11:58 +0200)
commit13696ffba238e5ab0a97736ff79319f307e0b171
treef35f386468aa91a8dc58012031d9d1d2db8805cf
parent99282ddb2c5ce1ab5a2918973e9a9b0b6a0233ee
BUG/MINOR: ring: fix the way watchers are counted

There are two problems with the way we count watchers on a ring:
  - the test for >=255 was accidently kept to 1 used during QA
  - if the producer deletes all data up to the reader's position
    and the reader is called, cannot write, and is called again,
    it will have a zero offset, causing it to initialize itself
    multiple times and each time adding a new refcount.

Let's change this and instead use ~0 as the initial offset as it's
not possible to have it as a valid one. We now store it into the
CLI context's size_t o0 instead of casting it to a void*.

No backport needed.
src/ring.c