summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Denoyelle <adenoyelle@haproxy.com>2023-05-15 15:17:28 +0200
committerAmaury Denoyelle <adenoyelle@haproxy.com>2023-05-16 17:53:45 +0200
commit1a2faef92fab683b240b6dc2ff7bf9eae2520320 (patch)
tree95dfa35700aed241ed917f20a24c09b8b1f456e6
parent3cb78140cf35faa19fd6fecaac27efc0f86b7e35 (diff)
downloadhaproxy-1a2faef92fab683b240b6dc2ff7bf9eae2520320.tar.gz
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.
-rw-r--r--include/haproxy/mux_quic.h46
-rw-r--r--src/mux_quic.c44
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 <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.
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 <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.
*/