]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: uninline qc_attach_sc()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 15 May 2023 13:17:28 +0000 (15:17 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 16 May 2023 15:53:45 +0000 (17:53 +0200)
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
src/mux_quic.c

index 0e408bd1872a621dda3a5d85e31762ac9cba9fa5..c750134cfe3824e52a9131ae9fc7c4ceb5d826bf 100644 (file)
 #include <haproxy/connection.h>
 #include <haproxy/list.h>
 #include <haproxy/mux_quic-t.h>
-#include <haproxy/stream.h>
+#include <haproxy/stconn.h>
 
 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 <qcs_wait_http_req> for more info.
-        */
-       BUG_ON_HOT(!LIST_INLIST(&qcs->el_opening));
-       LIST_DEL_INIT(&qcs->el_opening);
-
-       return qcs->sd->sc;
-}
-
 /* Register <qcs> 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.
index 42308d8f5f409b453e0b6febee6a6c600aa454bc..3cc24108d146229c1c26119741a7b2e6517e0f27 100644 (file)
@@ -19,6 +19,7 @@
 #include <haproxy/quic_tp-t.h>
 #include <haproxy/ssl_sock-t.h>
 #include <haproxy/stconn.h>
+#include <haproxy/time.h>
 #include <haproxy/trace.h>
 
 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 <qcs_wait_http_req> 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 <id> which is not in <qcc> stream tree. It
  * returns true if the associated stream is closed.
  */