BUG/MEDIUM: stconn: Report error on SC on send if a previous SE error was set
When a send on a connection is performed, if a SE error (or a pending error)
was already reported earlier, we leave immediately. No send is performed.
However, we must be sure to report the error at the SC level if necessary.
Indeed, the SE error may have been reported during the zero-copy data
forwarding. So during receive on the opposite side. In that case, we may
have missed the opportunity to report it at the SC level.
The patch must be backported as far as 2.8.
(cherry picked from commit 5dc45445ff18207dbacebf1f777e1f1abcd5065d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit e2a93b649286b30245333eec5851acd3991fda47)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 7de1f66d75ca41f9ae2a4dd44e5a105d2a9f90b5)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/stconn.c b/src/stconn.c
index 20a1d9b..2df175e 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -1586,6 +1586,8 @@
if (sc->state < SC_ST_CON)
return 0;
BUG_ON(sc_ep_test(sc, SE_FL_EOS|SE_FL_ERROR|SE_FL_ERR_PENDING) == (SE_FL_EOS|SE_FL_ERR_PENDING));
+ if (sc_ep_test(sc, SE_FL_ERROR))
+ sc->flags |= SC_FL_ERROR;
return 1;
}