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.
This commit is contained in:
Christopher Faulet 2022-10-17 10:21:19 +02:00
parent ab79b321d6
commit 7f6aa56d47
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}