From 7f6aa56d471c44776a2533887c2b57f90865b80c Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 17 Oct 2022 10:21:19 +0200 Subject: [PATCH] MINOR: sconn: Set SE_FL_ERROR only when there is no more data to read SE_FL_ERR_PENDING flag is used when there is still data to be read. So we must take care to not set SE_FL_ERROR too early. Thus, on sending path, it must be set if SE_FL_EOS was already set. --- src/stconn.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/stconn.c b/src/stconn.c index a6ed548e19..44f591cc1e 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -792,7 +792,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc) if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING) || sc_is_conn_error(sc)) { /* Write error on the file descriptor */ - if (sc->state >= SC_ST_CON) + if (sc->state >= SC_ST_CON && sc_ep_test(sc, SE_FL_EOS)) sc_ep_set(sc, SE_FL_ERROR); goto out_wakeup; } @@ -1650,7 +1650,8 @@ static int sc_conn_send(struct stconn *sc) */ if (sc->state < SC_ST_CON) return 0; - sc_ep_set(sc, SE_FL_ERROR); + if (sc_ep_test(sc, SE_FL_EOS)) + sc_ep_set(sc, SE_FL_ERROR); return 1; } @@ -1764,7 +1765,8 @@ static int sc_conn_send(struct stconn *sc) } if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING)) { - sc_ep_set(sc, SE_FL_ERROR); + if (sc_ep_test(sc, SE_FL_EOS)) + sc_ep_set(sc, SE_FL_ERROR); return 1; }