m) optimize new conn logic (#443)

1) on_new_conn only be called after handshake_ok
2) on_conn_closed only be called by ietf_full_conn_ci_destroy

Co-authored-by: wangfuyu <ivanfywang@gmail.com>
This commit is contained in:
wangfuyu 2022-12-15 00:30:34 +08:00 committed by GitHub
parent 850b0a3d10
commit b5efa50a5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1681,14 +1681,14 @@ lsquic_ietf_full_conn_server_new (struct lsquic_engine_public *enpub,
conn->ifc_last_live_update = now;
if (0 != handshake_ok(&conn->ifc_conn))
goto err3;
LSQ_DEBUG("Calling on_new_conn callback");
conn->ifc_conn.cn_conn_ctx = conn->ifc_enpub->enp_stream_if->on_new_conn(
conn->ifc_enpub->enp_stream_if_ctx, &conn->ifc_conn);
conn->ifc_idle_to = conn->ifc_settings->es_idle_timeout * 1000000;
if (0 != handshake_ok(&conn->ifc_conn))
goto err3;
conn->ifc_created = imc->imc_created;
if (conn->ifc_idle_to)
lsquic_alarmset_set(&conn->ifc_alset, AL_IDLE,
@ -1708,7 +1708,6 @@ lsquic_ietf_full_conn_server_new (struct lsquic_engine_public *enpub,
return &conn->ifc_conn;
err3:
conn->ifc_enpub->enp_stream_if->on_conn_closed(&conn->ifc_conn);
ietf_full_conn_ci_destroy(&conn->ifc_conn);
return NULL;