Skip to content

Is there a problem with the RTT calculation logic in send_ctl_acked_loss_chain? #596

@xiaowei0828

Description

@xiaowei0828

The origin code:

static void
send_ctl_acked_loss_chain (struct lsquic_send_ctl *ctl,
                        struct lsquic_packet_out *const packet_out,
                        struct lsquic_packet_out **next,
                        lsquic_packno_t largest_acked,
                        signed char *do_rtt)
{
    struct lsquic_packet_out *chain_cur, *chain_next;
    unsigned count;
    count = 0;
    for (chain_cur = packet_out->po_loss_chain; chain_cur != packet_out;
                                                    chain_cur = chain_next)
    {
        chain_next = chain_cur->po_loss_chain;
        if (chain_cur->po_packno == largest_acked)
            *do_rtt = 1;
        send_ctl_process_loss_chain_pkt(ctl, chain_cur, next);
        ++count;
    }
    packet_out->po_loss_chain = packet_out;

    if (count)
        LSQ_DEBUG("destroyed %u packet%.*s in chain of packet #%"PRIu64,
            count, count != 1, "s", packet_out->po_packno);
}

The fix code, when do_rtt, we should set sc_largest_acked_packno and sc_largest_acked_sent_time to the latest value

static void
send_ctl_acked_loss_chain (struct lsquic_send_ctl *ctl,
                        struct lsquic_packet_out *const packet_out,
                        struct lsquic_packet_out **next,
                        lsquic_packno_t largest_acked,
                        signed char *do_rtt)
{
    struct lsquic_packet_out *chain_cur, *chain_next;
    unsigned count;
    count = 0;
    for (chain_cur = packet_out->po_loss_chain; chain_cur != packet_out;
                                                    chain_cur = chain_next)
    {
        chain_next = chain_cur->po_loss_chain;
        if (chain_cur->po_packno == largest_acked) {
             // we should set sc_largest_acked_packno and sc_largest_acked_sent_time to the latest value
             ctl->sc_largest_acked_packno = chain_cur->po_packno;
             ctl->sc_largest_acked_sent_time = chain_cur->po_sent;
            *do_rtt = 1;
        }
        send_ctl_process_loss_chain_pkt(ctl, chain_cur, next);
        ++count;
    }
    packet_out->po_loss_chain = packet_out;

    if (count)
        LSQ_DEBUG("destroyed %u packet%.*s in chain of packet #%"PRIu64,
            count, count != 1, "s", packet_out->po_packno);
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions