mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-06 13:33:02 +00:00
MEDIUM: tree-wide: Stop to set SE_FL_ERROR from upper layer
We can now fully rely on SC_FL_ERROR flag from the stream. The first step is to stop to set the SE_FL_ERROR flag. Only endpoints are responsible to set this flag. It was a design limitation. It is now fixed.
This commit is contained in:
parent
ad46e52814
commit
88d05a0f3b
@ -1822,10 +1822,8 @@ skip_reuse:
|
||||
* sockets, socket pairs, andoccasionally TCP connections on the
|
||||
* loopback on a heavily loaded system.
|
||||
*/
|
||||
if (srv_conn->flags & CO_FL_ERROR) {
|
||||
sc_ep_set(s->scb, SE_FL_ERROR);
|
||||
if (srv_conn->flags & CO_FL_ERROR)
|
||||
s->scb->flags |= SC_FL_ERROR;
|
||||
}
|
||||
|
||||
/* If we had early data, and the handshake ended, then
|
||||
* we can remove the flag, and attempt to wake the task up,
|
||||
@ -2026,7 +2024,6 @@ void back_try_conn_req(struct stream *s)
|
||||
/* Failed and not retryable. */
|
||||
sc_abort(sc);
|
||||
sc_shutdown(sc);
|
||||
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
|
||||
sc->flags |= SC_FL_ERROR;
|
||||
|
||||
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||
@ -2047,7 +2044,6 @@ void back_try_conn_req(struct stream *s)
|
||||
* allocation problem, so we want to retry now.
|
||||
*/
|
||||
sc->state = SC_ST_CER;
|
||||
sc_ep_clr(sc, SE_FL_ERROR);
|
||||
sc->flags &= ~SC_FL_ERROR;
|
||||
back_handle_st_cer(s);
|
||||
|
||||
@ -2188,7 +2184,6 @@ void back_handle_st_req(struct stream *s)
|
||||
|
||||
sc_abort(sc);
|
||||
sc_shutdown(sc);
|
||||
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
|
||||
sc->flags |= SC_FL_ERROR;
|
||||
s->conn_err_type = STRM_ET_CONN_RES;
|
||||
sc->state = SC_ST_CLO;
|
||||
@ -2215,7 +2210,6 @@ void back_handle_st_req(struct stream *s)
|
||||
/* we did not get any server, let's check the cause */
|
||||
sc_abort(sc);
|
||||
sc_shutdown(sc);
|
||||
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
|
||||
sc->flags |= SC_FL_ERROR;
|
||||
if (!s->conn_err_type)
|
||||
s->conn_err_type = STRM_ET_CONN_OTHER;
|
||||
@ -2350,7 +2344,6 @@ void back_handle_st_cer(struct stream *s)
|
||||
|
||||
/* shutw is enough to stop a connecting socket */
|
||||
sc_shutdown(sc);
|
||||
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
|
||||
sc->flags |= SC_FL_ERROR;
|
||||
|
||||
sc->state = SC_ST_CLO;
|
||||
@ -2369,7 +2362,7 @@ void back_handle_st_cer(struct stream *s)
|
||||
* layers in an unexpected state (i.e < ST_CONN).
|
||||
*
|
||||
* Note: the stream connector will be switched to ST_REQ, ST_ASS or
|
||||
* ST_TAR and SE_FL_ERROR and SF_CONN_EXP flags will be unset.
|
||||
* ST_TAR and SC_FL_ERROR and SF_CONN_EXP flags will be unset.
|
||||
*/
|
||||
if (sc_reset_endp(sc) < 0) {
|
||||
if (!s->conn_err_type)
|
||||
@ -2384,7 +2377,6 @@ void back_handle_st_cer(struct stream *s)
|
||||
|
||||
/* shutw is enough to stop a connecting socket */
|
||||
sc_shutdown(sc);
|
||||
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
|
||||
sc->flags |= SC_FL_ERROR;
|
||||
|
||||
sc->state = SC_ST_CLO;
|
||||
|
@ -1725,11 +1725,11 @@ static int sc_conn_process(struct stconn *sc)
|
||||
|
||||
/* First step, report to the stream connector what was detected at the
|
||||
* connection layer : errors and connection establishment.
|
||||
* Only add SE_FL_ERROR if we're connected, or we're attempting to
|
||||
* Only add SC_FL_ERROR if we're connected, or we're attempting to
|
||||
* connect, we may get there because we got woken up, but only run
|
||||
* after process_stream() noticed there were an error, and decided
|
||||
* to retry to connect, the connection may still have CO_FL_ERROR,
|
||||
* and we don't want to add SE_FL_ERROR back
|
||||
* and we don't want to add SC_FL_ERROR back
|
||||
*
|
||||
* Note: This test is only required because sc_conn_process is also the SI
|
||||
* wake callback. Otherwise sc_conn_recv()/sc_conn_send() already take
|
||||
@ -1737,10 +1737,8 @@ static int sc_conn_process(struct stconn *sc)
|
||||
*/
|
||||
|
||||
if (sc->state >= SC_ST_CON) {
|
||||
if (sc_is_conn_error(sc)) {
|
||||
sc_ep_set(sc, SE_FL_ERROR);
|
||||
if (sc_is_conn_error(sc))
|
||||
sc->flags |= SC_FL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we had early data, and the handshake ended, then
|
||||
|
@ -1805,11 +1805,9 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
* must be be reviewed too.
|
||||
*/
|
||||
if (!stream_alloc_work_buffer(s)) {
|
||||
sc_ep_set(s->scf, SE_FL_ERROR);
|
||||
scf->flags |= SC_FL_ERROR;
|
||||
s->conn_err_type = STRM_ET_CONN_RES;
|
||||
|
||||
sc_ep_set(s->scb, SE_FL_ERROR);
|
||||
scb->flags |= SC_FL_ERROR;
|
||||
s->conn_err_type = STRM_ET_CONN_RES;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user