MINOR: stream-int: Remove SI_FL_KILL_CON to rely on conn-stream endpoint only

Instead of setting a stream-interface flag to then set the corresponding
conn-stream endpoint flag, we now only rely the conn-stream endoint. Thus
SI_FL_KILL_CON is replaced by CS_EP_KILL_CONN.

In addition si_must_kill_conn() is replaced by cs_must_kill_conn().
This commit is contained in:
Christopher Faulet 2022-03-30 14:42:50 +02:00
parent 7b5ca8f457
commit 9a52123800
7 changed files with 15 additions and 19 deletions

View File

@ -263,7 +263,6 @@ void show_si_flags(unsigned int f)
return;
}
SHOW_FLAG(f, SI_FL_KILL_CONN);
SHOW_FLAG(f, SI_FL_WAIT_DATA);
SHOW_FLAG(f, SI_FL_ISBACK);
SHOW_FLAG(f, SI_FL_DONT_WAKE);

View File

@ -187,4 +187,11 @@ static inline int cs_get_dst(struct conn_stream *cs)
return 1;
}
/* Marks on the conn-stream that next shutw must kill the whole connection */
static inline void cs_must_kill_conn(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_KILL_CONN;
}
#endif /* _HAPROXY_CS_UTILS_H */

View File

@ -84,7 +84,6 @@ enum {
enum {
SI_FL_NONE = 0x00000000, /* nothing */
/* unused: 0x00000001, 0x00000002 */
SI_FL_KILL_CONN = 0x00000004, /* next shutw must kill the whole conn, not just the stream */
SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */
SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */
SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */

View File

@ -327,12 +327,6 @@ static inline void si_shutw(struct stream_interface *si)
si->ops->shutw(si);
}
/* Marks on the stream-interface that next shutw must kill the whole connection */
static inline void si_must_kill_conn(struct stream_interface *si)
{
si->flags |= SI_FL_KILL_CONN;
}
/* This is to be used after making some room available in a channel. It will
* return without doing anything if the stream interface's RX path is blocked.
* It will automatically mark the stream interface as busy processing the end

View File

@ -23,6 +23,8 @@
#include <haproxy/capture-t.h>
#include <haproxy/cfgparse.h>
#include <haproxy/chunk.h>
#include <haproxy/conn_stream.h>
#include <haproxy/cs_utils.h>
#include <haproxy/global.h>
#include <haproxy/http.h>
#include <haproxy/http_ana.h>
@ -718,7 +720,7 @@ static enum act_parse_ret parse_http_set_status(const char **args, int *orig_arg
static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
si_must_kill_conn(chn_prod(&s->req)->si);
cs_must_kill_conn(chn_prod(&s->req));
channel_abort(&s->req);
channel_abort(&s->res);
s->req.analysers &= AN_REQ_FLT_END;

View File

@ -1038,9 +1038,6 @@ static void stream_int_shutr_conn(struct stream_interface *si)
if (!si_state_in(si->state, SI_SB_CON|SI_SB_RDY|SI_SB_EST))
return;
if (si->flags & SI_FL_KILL_CONN)
cs->endp->flags |= CS_EP_KILL_CONN;
if (si_oc(si)->flags & CF_SHUTW) {
cs_close(cs);
si->state = SI_ST_DIS;
@ -1089,8 +1086,6 @@ static void stream_int_shutw_conn(struct stream_interface *si)
* However, if SI_FL_NOLINGER is explicitly set, we know there is
* no risk so we close both sides immediately.
*/
if (si->flags & SI_FL_KILL_CONN)
cs->endp->flags |= CS_EP_KILL_CONN;
if (cs->endp->flags & CS_EP_ERROR) {
/* quick close, the socket is already shut anyway */
@ -1121,8 +1116,6 @@ static void stream_int_shutw_conn(struct stream_interface *si)
/* we may have to close a pending connection, and mark the
* response buffer as shutr
*/
if (si->flags & SI_FL_KILL_CONN)
cs->endp->flags |= CS_EP_KILL_CONN;
cs_close(cs);
/* fall through */
case SI_ST_CER:

View File

@ -17,6 +17,8 @@
#include <haproxy/cfgparse.h>
#include <haproxy/channel.h>
#include <haproxy/connection.h>
#include <haproxy/conn_stream.h>
#include <haproxy/cs_utils.h>
#include <haproxy/global.h>
#include <haproxy/list.h>
#include <haproxy/log.h>
@ -253,7 +255,7 @@ resume_execution:
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
reject:
si_must_kill_conn(chn_prod(req)->si);
cs_must_kill_conn(chn_prod(req));
channel_abort(req);
channel_abort(&s->res);
@ -391,7 +393,7 @@ resume_execution:
}
else if (rule->action == ACT_TCP_CLOSE) {
chn_prod(rep)->si->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
si_must_kill_conn(chn_prod(rep)->si);
cs_must_kill_conn(chn_prod(rep));
si_shutr(chn_prod(rep)->si);
si_shutw(chn_prod(rep)->si);
s->last_rule_file = rule->conf.file;
@ -450,7 +452,7 @@ resume_execution:
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
reject:
si_must_kill_conn(chn_prod(rep)->si);
cs_must_kill_conn(chn_prod(rep));
channel_abort(rep);
channel_abort(&s->req);