MINOR: quic-be: xprt ->init() adapatations
Allocate a connection to connect to QUIC servers from qc_conn_init() which is the ->init() QUIC xprt callback. Also initialize ->prepare_srv and ->destroy_srv callback as this done for TCP servers.
This commit is contained in:
parent
29fb1aee57
commit
f7c0f5ac1b
@ -1117,7 +1117,7 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
|
||||
qc->idle_timer_task = NULL;
|
||||
|
||||
qc->xprt_ctx = NULL;
|
||||
qc->conn = NULL;
|
||||
qc->conn = conn;
|
||||
qc->qcc = NULL;
|
||||
qc->app_ops = NULL;
|
||||
qc->path = NULL;
|
||||
|
@ -111,10 +111,25 @@ static int quic_conn_unsubscribe(struct connection *conn, void *xprt_ctx, int ev
|
||||
*/
|
||||
static int qc_conn_init(struct connection *conn, void **xprt_ctx)
|
||||
{
|
||||
struct quic_conn *qc = conn->handle.qc;
|
||||
int ret = -1;
|
||||
struct quic_conn *qc = NULL;
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_NEW, qc);
|
||||
|
||||
if (objt_listener(conn->target)) {
|
||||
qc = conn->handle.qc;
|
||||
}
|
||||
else {
|
||||
int ipv4 = conn->dst->ss_family == AF_INET;
|
||||
struct server *srv = objt_server(conn->target);
|
||||
qc = qc_new_conn(quic_version_1, ipv4, NULL, NULL, NULL,
|
||||
NULL, NULL, &srv->addr, 0, 0, srv, conn);
|
||||
}
|
||||
|
||||
if (!qc)
|
||||
goto out;
|
||||
|
||||
ret = 0;
|
||||
/* Ensure thread connection migration is finalized ASAP. */
|
||||
if (qc->flags & QUIC_FL_CONN_TID_REBIND)
|
||||
qc_finalize_tid_rebind(qc);
|
||||
@ -128,7 +143,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
|
||||
out:
|
||||
TRACE_LEAVE(QUIC_EV_CONN_NEW, qc);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Start the QUIC transport layer */
|
||||
@ -178,6 +193,8 @@ static struct xprt_ops ssl_quic = {
|
||||
.start = qc_xprt_start,
|
||||
.prepare_bind_conf = ssl_sock_prepare_bind_conf,
|
||||
.destroy_bind_conf = ssl_sock_destroy_bind_conf,
|
||||
.prepare_srv = ssl_sock_prepare_srv_ctx,
|
||||
.destroy_srv = ssl_sock_free_srv_ctx,
|
||||
.get_alpn = ssl_sock_get_alpn,
|
||||
.get_ssl_sock_ctx = qc_get_ssl_sock_ctx,
|
||||
.dump_info = qc_xprt_dump_info,
|
||||
|
Loading…
x
Reference in New Issue
Block a user