CLEANUP: mux-quic: remove stconn usage in h3/hq

Small cleanup on snd_buf for application protocol layer.
* do not export h3_snd_buf
* replace stconn by a qcs argument. This is better as h3/hq-interop only
  uses the qcs instance.

This should be backported up to 2.6.
This commit is contained in:
Amaury Denoyelle 2022-09-15 11:22:32 +02:00
parent 7c4b2ec09d
commit 8d4ac48d3d
5 changed files with 5 additions and 12 deletions

View File

@ -111,7 +111,5 @@ enum h3s_st_req {
extern const struct qcc_app_ops h3_ops;
size_t h3_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, int flags);
#endif /* USE_QUIC */
#endif /* _HAPROXY_H3_T_H */

View File

@ -185,7 +185,7 @@ struct qcc_app_ops {
int (*init)(struct qcc *qcc);
int (*attach)(struct qcs *qcs, void *conn_ctx);
ssize_t (*decode_qcs)(struct qcs *qcs, struct buffer *b, int fin);
size_t (*snd_buf)(struct stconn *sc, struct buffer *buf, size_t count, int flags);
size_t (*snd_buf)(struct qcs *qcs, struct buffer *buf, size_t count, int flags);
void (*detach)(struct qcs *qcs);
int (*finalize)(void *ctx);
void (*shutdown)(void *ctx); /* Close a connection. */

View File

@ -31,7 +31,6 @@
#include <haproxy/qpack-dec.h>
#include <haproxy/qpack-enc.h>
#include <haproxy/quic_enc.h>
#include <haproxy/stconn.h>
#include <haproxy/tools.h>
#include <haproxy/trace.h>
#include <haproxy/xprt_quic.h>
@ -1013,10 +1012,9 @@ static int h3_resp_data_send(struct qcs *qcs, struct buffer *buf, size_t count)
return total;
}
size_t h3_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, int flags)
static size_t h3_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count, int flags)
{
size_t total = 0;
struct qcs *qcs = __sc_mux_strm(sc);
struct htx *htx;
enum htx_blk_type btype;
struct htx_blk *blk;

View File

@ -12,7 +12,6 @@ static ssize_t hq_interop_decode_qcs(struct qcs *qcs, struct buffer *b, int fin)
{
struct htx *htx;
struct htx_sl *sl;
struct stconn *sc;
struct buffer htx_buf = BUF_NULL;
struct ist path;
char *ptr = b_head(b);
@ -70,8 +69,7 @@ static ssize_t hq_interop_decode_qcs(struct qcs *qcs, struct buffer *b, int fin)
htx_add_endof(htx, HTX_BLK_EOH);
htx_to_buf(htx, &htx_buf);
sc = qc_attach_sc(qcs, &htx_buf);
if (!sc)
if (!qc_attach_sc(qcs, &htx_buf))
return -1;
b_free(&htx_buf);
@ -90,10 +88,9 @@ static struct buffer *mux_get_buf(struct qcs *qcs)
return &qcs->tx.buf;
}
static size_t hq_interop_snd_buf(struct stconn *sc, struct buffer *buf,
static size_t hq_interop_snd_buf(struct qcs *qcs, struct buffer *buf,
size_t count, int flags)
{
struct qcs *qcs = __sc_mux_strm(sc);
struct htx *htx;
enum htx_blk_type btype;
struct htx_blk *blk;

View File

@ -2225,7 +2225,7 @@ static size_t qc_snd_buf(struct stconn *sc, struct buffer *buf,
goto end;
}
ret = qcs->qcc->app_ops->snd_buf(sc, buf, count, flags);
ret = qcs->qcc->app_ops->snd_buf(qcs, buf, count, flags);
end:
TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);