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.
diff --git a/src/stconn.c b/src/stconn.c
index eca1e45..f6ca85a 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -798,8 +798,7 @@
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 @@
*/
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 @@
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;
}