mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Connection ID Steering (#165)
This commit is contained in:
parent
fcd21c67ff
commit
ece7c94dac
6 changed files with 30 additions and 5 deletions
|
@ -1186,6 +1186,12 @@ struct lsquic_engine_api
|
|||
*/
|
||||
const struct lsquic_packout_mem_if *ea_pmi;
|
||||
void *ea_pmi_ctx;
|
||||
|
||||
/**
|
||||
* Optional interface to control the creation of connection IDs
|
||||
*/
|
||||
void (*es_generate_scid)(lsquic_conn_t *, lsquic_cid_t *, unsigned);
|
||||
|
||||
/**
|
||||
* Optional interface to report new and old source connection IDs.
|
||||
*/
|
||||
|
|
|
@ -553,8 +553,13 @@ gen_trans_params (struct enc_sess_iquic *enc_sess, unsigned char *buf,
|
|||
}
|
||||
cce->cce_seqno = seqno + 1;
|
||||
cce->cce_flags = CCE_SEQNO;
|
||||
lsquic_generate_cid(&cce->cce_cid,
|
||||
enc_sess->esi_enpub->enp_settings.es_scid_len);
|
||||
|
||||
if (enc_sess->esi_enpub->enp_generate_scid)
|
||||
enc_sess->esi_enpub->enp_generate_scid(enc_sess->esi_conn, &cce->cce_cid, enc_sess->esi_enpub->enp_settings.es_scid_len);
|
||||
else
|
||||
lsquic_generate_cid(&cce->cce_cid, enc_sess->esi_enpub->enp_settings.es_scid_len);
|
||||
|
||||
|
||||
/* Don't add to hash: migration must not start until *after*
|
||||
* handshake is complete.
|
||||
*/
|
||||
|
|
|
@ -576,6 +576,9 @@ lsquic_engine_new (unsigned flags,
|
|||
engine->pub.enp_lookup_cert = api->ea_lookup_cert;
|
||||
engine->pub.enp_cert_lu_ctx = api->ea_cert_lu_ctx;
|
||||
engine->pub.enp_get_ssl_ctx = api->ea_get_ssl_ctx;
|
||||
|
||||
engine->pub.enp_generate_scid = api->es_generate_scid;
|
||||
|
||||
if (api->ea_shi)
|
||||
{
|
||||
engine->pub.enp_shi = api->ea_shi;
|
||||
|
|
|
@ -44,6 +44,7 @@ struct lsquic_engine_public {
|
|||
void *enp_stream_if_ctx;
|
||||
const struct lsquic_hset_if *enp_hsi_if;
|
||||
void *enp_hsi_ctx;
|
||||
void (*enp_generate_scid)(lsquic_conn_t *, lsquic_cid_t *, unsigned);
|
||||
int (*enp_verify_cert)(void *verify_ctx,
|
||||
struct stack_st_X509 *chain);
|
||||
void *enp_verify_ctx;
|
||||
|
|
|
@ -1086,7 +1086,13 @@ ietf_full_conn_add_scid (struct ietf_full_conn *conn,
|
|||
}
|
||||
|
||||
if (enpub->enp_settings.es_scid_len)
|
||||
lsquic_generate_cid(&cce->cce_cid, enpub->enp_settings.es_scid_len);
|
||||
{
|
||||
if (enpub->enp_generate_scid)
|
||||
enpub->enp_generate_scid(lconn, &cce->cce_cid, enpub->enp_settings.es_scid_len);
|
||||
else
|
||||
lsquic_generate_cid(&cce->cce_cid, enpub->enp_settings.es_scid_len);
|
||||
}
|
||||
|
||||
cce->cce_seqno = conn->ifc_scid_seqno++;
|
||||
cce->cce_flags |= CCE_SEQNO | flags;
|
||||
lconn->cn_cces_mask |= 1 << (cce - lconn->cn_cces);
|
||||
|
|
|
@ -495,8 +495,12 @@ lsquic_mini_conn_ietf_new (struct lsquic_engine_public *enpub,
|
|||
/* Generate new SCID. Since is not the original SCID, it is given
|
||||
* a sequence number (0) and therefore can be retired by the client.
|
||||
*/
|
||||
lsquic_generate_cid(&conn->imc_conn.cn_cces[1].cce_cid,
|
||||
enpub->enp_settings.es_scid_len);
|
||||
if (enpub->enp_settings.es_scid_len && enpub->enp_generate_scid)
|
||||
enpub->enp_generate_scid(&conn->imc_conn, &conn->imc_conn.cn_cces[1].cce_cid, enpub->enp_settings.es_scid_len);
|
||||
else
|
||||
lsquic_generate_cid(&conn->imc_conn.cn_cces[1].cce_cid, enpub->enp_settings.es_scid_len);
|
||||
|
||||
|
||||
LSQ_DEBUGC("generated SCID %"CID_FMT" at index %u, switching to it",
|
||||
CID_BITS(&conn->imc_conn.cn_cces[1].cce_cid), 1);
|
||||
conn->imc_conn.cn_cces[1].cce_flags = CCE_SEQNO | CCE_USED;
|
||||
|
|
Loading…
Reference in a new issue