MEDIUM: stconn: Rely on SC flags to handle errors instead of SE flags

It is the last commit on this subject. we stop to use SE_FL_ERROR flag from
the SC, except at the I/O level. Otherwise, we rely on SC_FL_ERROR
flag. Now, there should be a real separation between SE flags and SC flags.
This commit is contained in:
Christopher Faulet 2023-04-14 12:09:35 +02:00
parent e182a8e651
commit 25d9fe50f5

View File

@ -579,7 +579,7 @@ static void sc_app_shut(struct stconn *sc)
* However, if SC_FL_NOLINGER is explicitly set, we know there is * However, if SC_FL_NOLINGER is explicitly set, we know there is
* no risk so we close both sides immediately. * no risk so we close both sides immediately.
*/ */
if (!(sc->flags & (SC_FL_ERROR|SC_FL_NOLINGER|SC_FL_ABRT_DONE)) && !sc_ep_test(sc, SE_FL_ERROR) && if (!(sc->flags & (SC_FL_ERROR|SC_FL_NOLINGER|SC_FL_ABRT_DONE)) &&
!(ic->flags & CF_DONT_READ)) !(ic->flags & CF_DONT_READ))
return; return;
@ -705,7 +705,7 @@ static void sc_app_shut_conn(struct stconn *sc)
* no risk so we close both sides immediately. * no risk so we close both sides immediately.
*/ */
if ((sc->flags & SC_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR)) { if (sc->flags & SC_FL_ERROR) {
/* quick close, the socket is already shut anyway */ /* quick close, the socket is already shut anyway */
} }
else if (sc->flags & SC_FL_NOLINGER) { else if (sc->flags & SC_FL_NOLINGER) {
@ -903,7 +903,7 @@ static void sc_app_shut_applet(struct stconn *sc)
* However, if SC_FL_NOLINGER is explicitly set, we know there is * However, if SC_FL_NOLINGER is explicitly set, we know there is
* no risk so we close both sides immediately. * no risk so we close both sides immediately.
*/ */
if (!(sc->flags & (SC_FL_ERROR|SC_FL_NOLINGER|SC_FL_ABRT_DONE)) && !sc_ep_test(sc, SE_FL_ERROR) && if (!(sc->flags & (SC_FL_ERROR|SC_FL_NOLINGER|SC_FL_ABRT_DONE)) &&
!(ic->flags & CF_DONT_READ)) !(ic->flags & CF_DONT_READ))
return; return;
@ -1101,7 +1101,7 @@ static void sc_notify(struct stconn *sc)
* read event while consumer side is not established (CF_READ_EVENT + sco->state != SC_ST_EST) * read event while consumer side is not established (CF_READ_EVENT + sco->state != SC_ST_EST)
*/ */
((ic->flags & CF_READ_EVENT) && ((sc->flags & SC_FL_EOI) || (sc->flags & SC_FL_ABRT_DONE) || !ic->to_forward || sco->state != SC_ST_EST)) || ((ic->flags & CF_READ_EVENT) && ((sc->flags & SC_FL_EOI) || (sc->flags & SC_FL_ABRT_DONE) || !ic->to_forward || sco->state != SC_ST_EST)) ||
(sc->flags & SC_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR) || (sc->flags & SC_FL_ERROR) ||
/* changes on the consumption side */ /* changes on the consumption side */
sc_ep_test(sc, SE_FL_ERR_PENDING) || sc_ep_test(sc, SE_FL_ERR_PENDING) ||