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.
This commit is contained in:
Amaury Denoyelle 2023-05-15 15:17:28 +02:00
parent 3cb78140cf
commit 1a2faef92f
2 changed files with 46 additions and 44 deletions

View File

@ -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.

View 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.
*/