[BUG] Flush buffers also where there are exactly 0 bytes left
authorKrzysztof Piotr Oledzki <ole@ans.pl>
Sun, 20 Apr 2008 19:34:47 +0000 (21:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 21 Apr 2008 05:22:33 +0000 (07:22 +0200)
commit8e4b21d5eb9d3084425ffc4e22a2c513c590b517
tree431d721e82b9fb3d8f75f664a2dfff370b6a31de
parent7b4c5aee55955df76b2263377e112548fdeedafc
[BUG] Flush buffers also where there are exactly 0 bytes left

I noticed it was possible to get truncated http/csv stats. Sometimes.
Usually the problem disappeared as fast as it appeared, but once it
happend that my http-stats page was truncated for about one hour.
It was quite weird as it happened independently for csv and http
output and it took me some time to track & fix this bug.

Both buffer_write & buffer_write_chunk used to return 0 in two
situations: is case of success or where there was exactly 0 bytes
left. The first one is intentional but I believe the second one
is not as it was not possible to distinguish between successful
write and unsuccessful one, which means that if the buffer was 100%
filled, it was never flushed and it was not possible to write
more data.

This patch fixes this problem.
src/buffers.c
src/dumpstats.c