]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: Always ack EOS at the end of sc_conn_recv()
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 21 Mar 2023 10:25:21 +0000 (11:25 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:57:05 +0000 (08:57 +0200)
EOS is now acknowledge at the end of sc_conn_recv(), even if an error was
encountered. There is no reason to not do so, especially because, if it not
performed here, it will be ack in sc_conn_process().

Note, it is still performed in sc_conn_process() because this function is
also the .wake callback function and can be directly called from the lower
layer.

src/stconn.c

index 134af8f42034ab220c65464faf77df55b2a2d692..918653d5c50bd4fb162acb98e83691a0855b5367 100644 (file)
@@ -1472,21 +1472,23 @@ static int sc_conn_recv(struct stconn *sc)
                ret = 1;
        }
 
-       if (sc_ep_test(sc, SE_FL_ERROR))
-               ret = 1;
-       else if (sc_ep_test(sc, SE_FL_EOS)) {
+       if (sc_ep_test(sc, SE_FL_EOS)) {
                /* we received a shutdown */
                if (ic->flags & CF_AUTO_CLOSE)
                        channel_shutw_now(ic);
                sc_conn_read0(sc);
                ret = 1;
        }
+
+       if (sc_ep_test(sc, SE_FL_ERROR))
+               ret = 1;
        else if (!(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM)) &&
                 !(ic->flags & CF_SHUTR)) {
                /* Subscribe to receive events if we're blocking on I/O */
                conn->mux->subscribe(sc, SUB_RETRY_RECV, &sc->wait_event);
                se_have_no_more_data(sc->sedesc);
-       } else {
+       }
+       else {
                se_have_more_data(sc->sedesc);
                ret = 1;
        }