From b208d8cd64252c5ffee751216ff68b73c62666e3 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 21 Mar 2023 11:25:21 +0100 Subject: [PATCH] MINOR: stconn: Always ack EOS at the end of sc_conn_recv() 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 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/stconn.c b/src/stconn.c index 134af8f42..918653d5c 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -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; }