From 1a2faef92fab683b240b6dc2ff7bf9eae2520320 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 15 May 2023 15:17:28 +0200 Subject: [PATCH] MINOR: mux-quic: uninline qc_attach_sc() Uninline and move qc_attach_sc() function to implementation source file. This will be useful for next commit to add traces in it. This should be backported up to 2.7. --- include/haproxy/mux_quic.h | 46 ++------------------------------------ src/mux_quic.c | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/include/haproxy/mux_quic.h b/include/haproxy/mux_quic.h index 0e408bd18..c750134cf 100644 --- a/include/haproxy/mux_quic.h +++ b/include/haproxy/mux_quic.h @@ -10,10 +10,11 @@ #include #include #include -#include +#include void qcc_set_error(struct qcc *qcc, int err, int app); struct qcs *qcc_init_stream_local(struct qcc *qcc, int bidi); +struct stconn *qc_attach_sc(struct qcs *qcs, struct buffer *buf, char fin); struct buffer *qc_get_buf(struct qcs *qcs, struct buffer *bptr); int qcs_subscribe(struct qcs *qcs, int event_type, struct wait_event *es); @@ -87,49 +88,6 @@ static inline char *qcs_st_to_str(enum qcs_state st) int qcc_install_app_ops(struct qcc *qcc, const struct qcc_app_ops *app_ops); -static inline struct stconn *qc_attach_sc(struct qcs *qcs, struct buffer *buf) -{ - struct qcc *qcc = qcs->qcc; - struct session *sess = qcc->conn->owner; - - qcs->sd = sedesc_new(); - if (!qcs->sd) - return NULL; - - qcs->sd->se = qcs; - qcs->sd->conn = qcc->conn; - se_fl_set(qcs->sd, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); - se_expect_no_data(qcs->sd); - - /* TODO duplicated from mux_h2 */ - sess->t_idle = ns_to_ms(now_ns - sess->accept_ts) - sess->t_handshake; - - if (!sc_new_from_endp(qcs->sd, sess, buf)) - return NULL; - - /* QC_SF_HREQ_RECV must be set once for a stream. Else, nb_hreq counter - * will be incorrect for the connection. - */ - BUG_ON_HOT(qcs->flags & QC_SF_HREQ_RECV); - qcs->flags |= QC_SF_HREQ_RECV; - ++qcc->nb_sc; - ++qcc->nb_hreq; - - /* TODO duplicated from mux_h2 */ - sess->accept_date = date; - sess->accept_ts = now_ns; - sess->t_handshake = 0; - sess->t_idle = 0; - - /* A stream must have been registered for HTTP wait before attaching - * it to sedesc. See for more info. - */ - BUG_ON_HOT(!LIST_INLIST(&qcs->el_opening)); - LIST_DEL_INIT(&qcs->el_opening); - - return qcs->sd->sc; -} - /* Register stream for http-request timeout. If the stream is not yet * attached in the configured delay, qcc timeout task will be triggered. This * means the full header section was not received in time. diff --git a/src/mux_quic.c b/src/mux_quic.c index 42308d8f5..3cc24108d 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -19,6 +19,7 @@ #include #include #include +#include #include DECLARE_POOL(pool_head_qcc, "qcc", sizeof(struct qcc)); @@ -638,6 +639,49 @@ static struct qcs *qcc_init_stream_remote(struct qcc *qcc, uint64_t id) return NULL; } +struct stconn *qc_attach_sc(struct qcs *qcs, struct buffer *buf) +{ + struct qcc *qcc = qcs->qcc; + struct session *sess = qcc->conn->owner; + + qcs->sd = sedesc_new(); + if (!qcs->sd) + return NULL; + + qcs->sd->se = qcs; + qcs->sd->conn = qcc->conn; + se_fl_set(qcs->sd, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); + se_expect_no_data(qcs->sd); + + /* TODO duplicated from mux_h2 */ + sess->t_idle = ns_to_ms(now_ns - sess->accept_ts) - sess->t_handshake; + + if (!sc_new_from_endp(qcs->sd, sess, buf)) + return NULL; + + /* QC_SF_HREQ_RECV must be set once for a stream. Else, nb_hreq counter + * will be incorrect for the connection. + */ + BUG_ON_HOT(qcs->flags & QC_SF_HREQ_RECV); + qcs->flags |= QC_SF_HREQ_RECV; + ++qcc->nb_sc; + ++qcc->nb_hreq; + + /* TODO duplicated from mux_h2 */ + sess->accept_date = date; + sess->accept_ts = now_ns; + sess->t_handshake = 0; + sess->t_idle = 0; + + /* A stream must have been registered for HTTP wait before attaching + * it to sedesc. See for more info. + */ + BUG_ON_HOT(!LIST_INLIST(&qcs->el_opening)); + LIST_DEL_INIT(&qcs->el_opening); + + return qcs->sd->sc; +} + /* Use this function for a stream which is not in stream tree. It * returns true if the associated stream is closed. */