mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MEDIUM: quic: move conn->qc into conn->handle
It was supposed to be there, and probably was not placed there due to historic limitations in listener_accept(), but now there does not seem to be a remaining valid reason for keeping the quic_conn out of the handle. In addition in new_quic_cli_conn() the handle->fd was incorrectly set to the listener's FD.
This commit is contained in:
parent
54a1dcb1bb
commit
784b868c97
@ -327,10 +327,12 @@ struct wait_event {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* A connection handle is how we differentiate two connections on the lower
|
/* A connection handle is how we differentiate two connections on the lower
|
||||||
* layers. It usually is a file descriptor but can be a connection id.
|
* layers. It usually is a file descriptor but can be a connection id. The
|
||||||
|
* CO_FL_FDLESS flag indicates which one is relevant.
|
||||||
*/
|
*/
|
||||||
union conn_handle {
|
union conn_handle {
|
||||||
int fd; /* file descriptor, for regular sockets */
|
struct quic_conn *qc; /* Only present if this connection is a QUIC one (CO_FL_FDLESS=1) */
|
||||||
|
int fd; /* file descriptor, for regular sockets (CO_FL_FDLESS=0) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* xprt_ops describes transport-layer operations for a connection. They
|
/* xprt_ops describes transport-layer operations for a connection. They
|
||||||
@ -497,7 +499,6 @@ struct connection {
|
|||||||
struct sockaddr_storage *dst; /* destination address (pool), when known, otherwise NULL */
|
struct sockaddr_storage *dst; /* destination address (pool), when known, otherwise NULL */
|
||||||
struct ist proxy_authority; /* Value of the authority TLV received via PROXYv2 */
|
struct ist proxy_authority; /* Value of the authority TLV received via PROXYv2 */
|
||||||
struct ist proxy_unique_id; /* Value of the unique ID TLV received via PROXYv2 */
|
struct ist proxy_unique_id; /* Value of the unique ID TLV received via PROXYv2 */
|
||||||
struct quic_conn *qc; /* Only present if this connection is a QUIC one */
|
|
||||||
|
|
||||||
/* used to identify a backend connection for http-reuse,
|
/* used to identify a backend connection for http-reuse,
|
||||||
* thus only present if conn.target is of type OBJ_TYPE_SERVER
|
* thus only present if conn.target is of type OBJ_TYPE_SERVER
|
||||||
|
@ -433,7 +433,6 @@ void conn_init(struct connection *conn, void *target)
|
|||||||
conn->dst = NULL;
|
conn->dst = NULL;
|
||||||
conn->proxy_authority = IST_NULL;
|
conn->proxy_authority = IST_NULL;
|
||||||
conn->proxy_unique_id = IST_NULL;
|
conn->proxy_unique_id = IST_NULL;
|
||||||
conn->qc = NULL;
|
|
||||||
conn->hash_node = NULL;
|
conn->hash_node = NULL;
|
||||||
conn->xprt = NULL;
|
conn->xprt = NULL;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ void qcs_free(struct qcs *qcs)
|
|||||||
|
|
||||||
/* stream desc must be removed from MUX tree before release it */
|
/* stream desc must be removed from MUX tree before release it */
|
||||||
eb64_delete(&qcs->stream->by_id);
|
eb64_delete(&qcs->stream->by_id);
|
||||||
qc_stream_desc_release(qcs->stream, qcs->qcc->conn->qc);
|
qc_stream_desc_release(qcs->stream, qcs->qcc->conn->handle.qc);
|
||||||
pool_free(pool_head_qcs, qcs);
|
pool_free(pool_head_qcs, qcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ static void qc_release(struct qcc *qcc)
|
|||||||
if (conn) {
|
if (conn) {
|
||||||
LIST_DEL_INIT(&conn->stopping_list);
|
LIST_DEL_INIT(&conn->stopping_list);
|
||||||
|
|
||||||
conn->qc->conn = NULL;
|
conn->handle.qc->conn = NULL;
|
||||||
conn->mux = NULL;
|
conn->mux = NULL;
|
||||||
conn->ctx = NULL;
|
conn->ctx = NULL;
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ static int qc_send_frames(struct qcc *qcc, struct list *frms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!LIST_ISEMPTY(frms))
|
if (!LIST_ISEMPTY(frms))
|
||||||
qc_send_app_pkts(qcc->conn->qc, frms);
|
qc_send_app_pkts(qcc->conn->handle.qc, frms);
|
||||||
|
|
||||||
/* If there is frames left, check if the transport layer has send some
|
/* If there is frames left, check if the transport layer has send some
|
||||||
* data or is blocked.
|
* data or is blocked.
|
||||||
@ -976,7 +976,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
|
|||||||
qcc->streams_by_id = EB_ROOT_UNIQUE;
|
qcc->streams_by_id = EB_ROOT_UNIQUE;
|
||||||
|
|
||||||
/* Server parameters, params used for RX flow control. */
|
/* Server parameters, params used for RX flow control. */
|
||||||
lparams = &conn->qc->rx.params;
|
lparams = &conn->handle.qc->rx.params;
|
||||||
|
|
||||||
qcc->rx.max_data = lparams->initial_max_data;
|
qcc->rx.max_data = lparams->initial_max_data;
|
||||||
qcc->tx.sent_offsets = 0;
|
qcc->tx.sent_offsets = 0;
|
||||||
@ -1010,7 +1010,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
|
|||||||
qcc->lfctl.ms_bidi = qcc->lfctl.ms_bidi_init = lparams->initial_max_streams_bidi;
|
qcc->lfctl.ms_bidi = qcc->lfctl.ms_bidi_init = lparams->initial_max_streams_bidi;
|
||||||
qcc->lfctl.cl_bidi_r = 0;
|
qcc->lfctl.cl_bidi_r = 0;
|
||||||
|
|
||||||
rparams = &conn->qc->tx.params;
|
rparams = &conn->handle.qc->tx.params;
|
||||||
qcc->rfctl.md = rparams->initial_max_data;
|
qcc->rfctl.md = rparams->initial_max_data;
|
||||||
qcc->rfctl.msd_bidi_l = rparams->initial_max_stream_data_bidi_local;
|
qcc->rfctl.msd_bidi_l = rparams->initial_max_stream_data_bidi_local;
|
||||||
qcc->rfctl.msd_bidi_r = rparams->initial_max_stream_data_bidi_remote;
|
qcc->rfctl.msd_bidi_r = rparams->initial_max_stream_data_bidi_remote;
|
||||||
@ -1040,7 +1040,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HA_ATOMIC_STORE(&conn->qc->qcc, qcc);
|
HA_ATOMIC_STORE(&conn->handle.qc->qcc, qcc);
|
||||||
/* init read cycle */
|
/* init read cycle */
|
||||||
tasklet_wakeup(qcc->wait_event.tasklet);
|
tasklet_wakeup(qcc->wait_event.tasklet);
|
||||||
|
|
||||||
@ -1240,7 +1240,7 @@ static int qc_wake_some_streams(struct qcc *qcc)
|
|||||||
static int qc_wake(struct connection *conn)
|
static int qc_wake(struct connection *conn)
|
||||||
{
|
{
|
||||||
struct qcc *qcc = conn->ctx;
|
struct qcc *qcc = conn->ctx;
|
||||||
struct proxy *prx = conn->qc->li->bind_conf->frontend;
|
struct proxy *prx = conn->handle.qc->li->bind_conf->frontend;
|
||||||
|
|
||||||
TRACE_ENTER(QMUX_EV_QCC_WAKE, conn);
|
TRACE_ENTER(QMUX_EV_QCC_WAKE, conn);
|
||||||
|
|
||||||
@ -1252,7 +1252,7 @@ static int qc_wake(struct connection *conn)
|
|||||||
if (unlikely(prx->flags & (PR_FL_DISABLED|PR_FL_STOPPED)))
|
if (unlikely(prx->flags & (PR_FL_DISABLED|PR_FL_STOPPED)))
|
||||||
goto release;
|
goto release;
|
||||||
|
|
||||||
if (conn->qc->flags & QUIC_FL_CONN_NOTIFY_CLOSE)
|
if (conn->handle.qc->flags & QUIC_FL_CONN_NOTIFY_CLOSE)
|
||||||
qcc->conn->flags |= (CO_FL_SOCK_RD_SH|CO_FL_SOCK_WR_SH);
|
qcc->conn->flags |= (CO_FL_SOCK_RD_SH|CO_FL_SOCK_WR_SH);
|
||||||
|
|
||||||
qc_send(qcc);
|
qc_send(qcc);
|
||||||
|
@ -75,7 +75,7 @@ int quic_session_accept(struct connection *cli_conn)
|
|||||||
sess->listener = NULL;
|
sess->listener = NULL;
|
||||||
session_free(sess);
|
session_free(sess);
|
||||||
out_free_conn:
|
out_free_conn:
|
||||||
cli_conn->qc->conn = NULL;
|
cli_conn->handle.qc->conn = NULL;
|
||||||
conn_stop_tracking(cli_conn);
|
conn_stop_tracking(cli_conn);
|
||||||
conn_xprt_close(cli_conn);
|
conn_xprt_close(cli_conn);
|
||||||
conn_free(cli_conn);
|
conn_free(cli_conn);
|
||||||
@ -89,10 +89,10 @@ int quic_sock_get_src(struct connection *conn, struct sockaddr *addr, socklen_t
|
|||||||
{
|
{
|
||||||
struct quic_conn *qc;
|
struct quic_conn *qc;
|
||||||
|
|
||||||
if (!conn || !conn->qc)
|
if (!conn || !conn->handle.qc)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
qc = conn->qc;
|
qc = conn->handle.qc;
|
||||||
if (conn_is_back(conn)) {
|
if (conn_is_back(conn)) {
|
||||||
/* no source address defined for outgoing connections for now */
|
/* no source address defined for outgoing connections for now */
|
||||||
return -1;
|
return -1;
|
||||||
@ -110,10 +110,10 @@ int quic_sock_get_dst(struct connection *conn, struct sockaddr *addr, socklen_t
|
|||||||
{
|
{
|
||||||
struct quic_conn *qc;
|
struct quic_conn *qc;
|
||||||
|
|
||||||
if (!conn || !conn->qc)
|
if (!conn || !conn->handle.qc)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
qc = conn->qc;
|
qc = conn->handle.qc;
|
||||||
if (conn_is_back(conn)) {
|
if (conn_is_back(conn)) {
|
||||||
/* back connection, return the peer's address */
|
/* back connection, return the peer's address */
|
||||||
if (len > sizeof(qc->peer_addr))
|
if (len > sizeof(qc->peer_addr))
|
||||||
@ -151,9 +151,8 @@ static int new_quic_cli_conn(struct quic_conn *qc, struct listener *l,
|
|||||||
|
|
||||||
cli_conn->flags |= CO_FL_ADDR_FROM_SET | CO_FL_FDLESS;
|
cli_conn->flags |= CO_FL_ADDR_FROM_SET | CO_FL_FDLESS;
|
||||||
qc->conn = cli_conn;
|
qc->conn = cli_conn;
|
||||||
cli_conn->qc = qc;
|
cli_conn->handle.qc = qc;
|
||||||
|
|
||||||
cli_conn->handle.fd = l->rx.fd;
|
|
||||||
cli_conn->target = &l->obj_type;
|
cli_conn->target = &l->obj_type;
|
||||||
|
|
||||||
/* We need the xprt context before accepting (->accept()) the connection:
|
/* We need the xprt context before accepting (->accept()) the connection:
|
||||||
|
@ -5693,7 +5693,7 @@ static struct quic_tx_packet *qc_build_pkt(unsigned char **pos,
|
|||||||
*/
|
*/
|
||||||
static int quic_conn_subscribe(struct connection *conn, void *xprt_ctx, int event_type, struct wait_event *es)
|
static int quic_conn_subscribe(struct connection *conn, void *xprt_ctx, int event_type, struct wait_event *es)
|
||||||
{
|
{
|
||||||
struct qcc *qcc = conn->qc->qcc;
|
struct qcc *qcc = conn->handle.qc->qcc;
|
||||||
|
|
||||||
BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
|
BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
|
||||||
BUG_ON(qcc->subs && qcc->subs != es);
|
BUG_ON(qcc->subs && qcc->subs != es);
|
||||||
@ -5702,10 +5702,10 @@ static int quic_conn_subscribe(struct connection *conn, void *xprt_ctx, int even
|
|||||||
qcc->subs = es;
|
qcc->subs = es;
|
||||||
|
|
||||||
if (event_type & SUB_RETRY_RECV)
|
if (event_type & SUB_RETRY_RECV)
|
||||||
TRACE_DEVEL("subscribe(recv)", QUIC_EV_CONN_XPRTRECV, conn->qc, qcc);
|
TRACE_DEVEL("subscribe(recv)", QUIC_EV_CONN_XPRTRECV, conn->handle.qc, qcc);
|
||||||
|
|
||||||
if (event_type & SUB_RETRY_SEND)
|
if (event_type & SUB_RETRY_SEND)
|
||||||
TRACE_DEVEL("subscribe(send)", QUIC_EV_CONN_XPRTSEND, conn->qc, qcc);
|
TRACE_DEVEL("subscribe(send)", QUIC_EV_CONN_XPRTSEND, conn->handle.qc, qcc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5732,7 +5732,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
|
|||||||
if (*xprt_ctx)
|
if (*xprt_ctx)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
*xprt_ctx = conn->qc->xprt_ctx;
|
*xprt_ctx = conn->handle.qc->xprt_ctx;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
TRACE_LEAVE(QUIC_EV_CONN_NEW, qc);
|
TRACE_LEAVE(QUIC_EV_CONN_NEW, qc);
|
||||||
@ -5746,7 +5746,7 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
|
|||||||
struct quic_conn *qc;
|
struct quic_conn *qc;
|
||||||
struct ssl_sock_ctx *qctx = ctx;
|
struct ssl_sock_ctx *qctx = ctx;
|
||||||
|
|
||||||
qc = conn->qc;
|
qc = conn->handle.qc;
|
||||||
if (qcc_install_app_ops(qc->qcc, qc->app_ops)) {
|
if (qcc_install_app_ops(qc->qcc, qc->app_ops)) {
|
||||||
TRACE_PROTO("Cannot install app layer", QUIC_EV_CONN_LPKT, qc);
|
TRACE_PROTO("Cannot install app layer", QUIC_EV_CONN_LPKT, qc);
|
||||||
return 0;
|
return 0;
|
||||||
@ -5761,10 +5761,10 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
|
|||||||
|
|
||||||
static struct ssl_sock_ctx *qc_get_ssl_sock_ctx(struct connection *conn)
|
static struct ssl_sock_ctx *qc_get_ssl_sock_ctx(struct connection *conn)
|
||||||
{
|
{
|
||||||
if (!conn || conn->xprt != xprt_get(XPRT_QUIC) || !conn->qc || !conn->xprt_ctx)
|
if (!conn || conn->xprt != xprt_get(XPRT_QUIC) || !conn->handle.qc || !conn->xprt_ctx)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return conn->qc->xprt_ctx;
|
return conn->handle.qc->xprt_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* transport-layer operations for QUIC connections. */
|
/* transport-layer operations for QUIC connections. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user