Skip to content

Commit

Permalink
m) optimize new conn logic (#443)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
wangfuyu and wangfuyu authored Dec 14, 2022
1 parent 850b0a3 commit b5efa50
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/liblsquic/lsquic_full_conn_ietf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;

Expand Down

0 comments on commit b5efa50

Please sign in to comment.