MINOR: stconn: Stop to set SE_FL_ERROR on sending path

It is not the SC responsibility to report errors on the SE descriptor. It is
the endpoint responsibility. It must switch SE_FL_ERR_PENDING into
SE_FL_ERROR if the end of stream was detected. It can even be considered as
a bug if it is not done by he endpoint.

So now, on sending path, a BUG_ON() is added to abort if SE_FL_EOS and
SE_FL_ERR_PENDING flags are set but not SE_FL_ERROR. It is trully important
to handle this case in the endpoint to be able to properly shut the endpoint
down.
This commit is contained in:
Christopher Faulet 2023-04-14 09:42:59 +02:00
parent d3bc340e7e
commit 56a2b608b0

View File

@ -798,8 +798,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 && sc_ep_test(sc, SE_FL_EOS))
sc_ep_set(sc, SE_FL_ERROR);
BUG_ON(sc_ep_test(sc, SE_FL_EOS|SE_FL_ERROR|SE_FL_ERR_PENDING) == (SE_FL_EOS|SE_FL_ERR_PENDING));
goto out_wakeup;
}
@ -1554,8 +1553,7 @@ static int sc_conn_send(struct stconn *sc)
*/
if (sc->state < SC_ST_CON)
return 0;
if (sc_ep_test(sc, SE_FL_EOS))
sc_ep_set(sc, SE_FL_ERROR);
BUG_ON(sc_ep_test(sc, SE_FL_EOS|SE_FL_ERROR|SE_FL_ERR_PENDING) == (SE_FL_EOS|SE_FL_ERR_PENDING));
return 1;
}
@ -1670,8 +1668,7 @@ static int sc_conn_send(struct stconn *sc)
if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING)) {
oc->flags |= CF_WRITE_EVENT;
if (sc_ep_test(sc, SE_FL_EOS))
sc_ep_set(sc, SE_FL_ERROR);
BUG_ON(sc_ep_test(sc, SE_FL_EOS|SE_FL_ERROR|SE_FL_ERR_PENDING) == (SE_FL_EOS|SE_FL_ERR_PENDING));
return 1;
}