src/liblsquic/lsquic_send_ctl.c
/* When client updated DCID based on the first packet returned by the server,
 * we must update the number of bytes scheduled if the DCID length changed
 * because this length is used to calculate packet size.
 */
When client updated DCID based on the first packet returned by the server,
we must update the number of bytes scheduled if the DCID length changed
because this length is used to calculate packet size.
When client updated DCID based on the first packet returned by the server we must update the number of bytes scheduled if the DCID length changed because this length is used to calculate packet size .
void
lsquic_send_ctl_cidlen_change (struct lsquic_send_ctl *ctl,
                                unsigned orig_cid_len, unsigned new_cid_len)
{
    unsigned diff;
    assert(!(ctl->sc_conn_pub->lconn->cn_flags & LSCONN_SERVER));
    if (ctl->sc_n_scheduled)
    {
        ctl->sc_flags |= SC_CIDLEN;
        ctl->sc_cidlen = (signed char) new_cid_len - (signed char) orig_cid_len;
        if (new_cid_len > orig_cid_len)
        {
            diff = new_cid_len - orig_cid_len;
            diff *= ctl->sc_n_scheduled;
            ctl->sc_bytes_scheduled += diff;
            LSQ_DEBUG("increased bytes scheduled by %u bytes to %u",
                diff, ctl->sc_bytes_scheduled);
        }
        else if (new_cid_len < orig_cid_len)
        {
            diff = orig_cid_len - new_cid_len;
            diff *= ctl->sc_n_scheduled;
            ctl->sc_bytes_scheduled -= diff;
            LSQ_DEBUG("decreased bytes scheduled by %u bytes to %u",
                diff, ctl->sc_bytes_scheduled);
        }
        else
            LSQ_DEBUG("DCID length did not change");
    }
    else
        LSQ_DEBUG("no scheduled packets at the time of DCID change");
}
void lsquic_send_ctl_cidlen_change ( struct lsquic_send_ctl * ctl , unsigned orig_cid_len , unsigned new_cid_len ) { unsigned diff ; assert ( ! ( ctl -> sc_conn_pub -> lconn -> cn_flags & LSCONN_SERVER ) ) ; if ( ctl -> sc_n_scheduled ) { ctl -> sc_flags |= SC_CIDLEN ; ctl -> sc_cidlen = ( signed char ) new_cid_len - ( signed char ) orig_cid_len ; if ( new_cid_len > orig_cid_len ) { diff = new_cid_len - orig_cid_len ; diff *= ctl -> sc_n_scheduled ; ctl -> sc_bytes_scheduled += diff ; LSQ_DEBUG ( " " , diff , ctl -> sc_bytes_scheduled ) ; } else if ( new_cid_len < orig_cid_len ) { diff = orig_cid_len - new_cid_len ; diff *= ctl -> sc_n_scheduled ; ctl -> sc_bytes_scheduled -= diff ; LSQ_DEBUG ( " " , diff , ctl -> sc_bytes_scheduled ) ; } else LSQ_DEBUG ( " " ) ; } else LSQ_DEBUG ( " " ) ; }
When client updated DCID based on the first packet returned by the server,
 we must update the number of bytes scheduled if the DCID length changed
 because this length is used to calculate packet size.
When client updated DCID based on the first packet returned by the server we must update the number of bytes scheduled if the DCID length changed because this length is used to calculate packet size .