MINOR: quic: Simplication for qc_set_timer()

There is no reason to run code for nothing if the timer task has been
released when entering qc_set_timer().

Must be backported to 2.7.
This commit is contained in:
Frédéric Lécaille 2023-02-09 07:48:33 +01:00 committed by Amaury Denoyelle
parent dea3298282
commit dd41a45014

View File

@ -754,6 +754,12 @@ static inline void qc_set_timer(struct quic_conn *qc)
TRACE_ENTER(QUIC_EV_CONN_STIMER, qc, TRACE_ENTER(QUIC_EV_CONN_STIMER, qc,
NULL, NULL, &qc->path->ifae_pkts); NULL, NULL, &qc->path->ifae_pkts);
pktns = NULL;
if (!qc->timer_task) {
TRACE_PROTO("already released timer task", QUIC_EV_CONN_STIMER, qc);
goto leave;
}
pktns = quic_loss_pktns(qc); pktns = quic_loss_pktns(qc);
if (tick_isset(pktns->tx.loss_time)) { if (tick_isset(pktns->tx.loss_time)) {
qc->timer = pktns->tx.loss_time; qc->timer = pktns->tx.loss_time;
@ -782,7 +788,6 @@ static inline void qc_set_timer(struct quic_conn *qc)
if (tick_isset(pto)) if (tick_isset(pto))
qc->timer = pto; qc->timer = pto;
out: out:
if (qc->timer_task) {
if (qc->timer == TICK_ETERNITY) { if (qc->timer == TICK_ETERNITY) {
qc->timer_task->expire = TICK_ETERNITY; qc->timer_task->expire = TICK_ETERNITY;
} }
@ -794,7 +799,7 @@ static inline void qc_set_timer(struct quic_conn *qc)
TRACE_DEVEL("timer task scheduling", QUIC_EV_CONN_STIMER, qc); TRACE_DEVEL("timer task scheduling", QUIC_EV_CONN_STIMER, qc);
task_schedule(qc->timer_task, qc->timer); task_schedule(qc->timer_task, qc->timer);
} }
} leave:
TRACE_LEAVE(QUIC_EV_CONN_STIMER, qc, pktns); TRACE_LEAVE(QUIC_EV_CONN_STIMER, qc, pktns);
} }