MINOR: quic: Move conn_prepare() to ->accept_conn() callback

The xprt context must be initialized before receiving further packets from
the I/O dgram handler.
This commit is contained in:
Frédéric Lécaille 2021-06-14 10:31:43 +02:00 committed by Amaury Denoyelle
parent 6de7287cc7
commit 01ab6618fe

View File

@ -35,9 +35,6 @@ int quic_session_accept(struct connection *cli_conn)
struct session *sess; struct session *sess;
cli_conn->proxy_netns = l->rx.settings->netns; cli_conn->proxy_netns = l->rx.settings->netns;
if (conn_prepare(cli_conn, l->rx.proto, l->bind_conf->xprt) < 0)
goto out_free_conn;
/* This flag is ordinarily set by conn_ctrl_init() which cannot /* This flag is ordinarily set by conn_ctrl_init() which cannot
* be called for now. * be called for now.
*/ */
@ -113,14 +110,19 @@ static int new_quic_cli_conn(struct quic_conn *qc, struct listener *l,
/* XXX Should not be there. */ /* XXX Should not be there. */
l->accept = quic_session_accept; l->accept = quic_session_accept;
/* We need the xprt context before accepting (->accept()) the connection:
* we may receive packet before this connection acception.
*/
if (conn_prepare(cli_conn, l->rx.proto, l->bind_conf->xprt) < 0)
goto out_free_conn;
return 1; return 1;
out_free_conn: out_free_conn:
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);
qc->conn = NULL;
out: out:
return 0; return 0;