BUG/MEDIUM: channel: Be aware of SHUTW_NOW flag when output data are peeked
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 16 Jul 2020 09:43:46 +0000 (11:43 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 17 Jul 2020 10:44:07 +0000 (12:44 +0200)
commitb38bad071322200e78983e65688521f8741c3ce1
tree1918c21e87fbc9846c32675d2187d2ba50d7fef4
parenta0ceae5dd62de5b14134647906969d6c56df4a86
BUG/MEDIUM: channel: Be aware of SHUTW_NOW flag when output data are peeked

The CF_SHUTW_NOW flag must be handled the same way than the CF_SHUTW flag in
co_getblk_nc() and co_getline_nc() functions. It is especally important when we
try to peek a line from outgoing data. In this case, an unfinished line is
blocked an nothing is peeked if the CF_SHUTW_NOW flag is set. But the blocked
data pevent the transition to CF_SHUTW.

The above functions are only used by LUA cosockets. Because of this bug, we may
experienced wakeups in loop of the cosocket's io handler if we try to read a
line on a closed socket with a pending unfinished line (no LF found at the end).

This patch should fix issue #744. It must be backported to all supported
versions.

(cherry picked from commit f706a794d8b8d854cba4414adb6f9a1297c6fd02)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b95c6fe4a0b23b7ed69ea99e48680d29997fbdd7)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/channel.c