Commit 76020ba
fix(quinn): handle overdue timers without polling the async timer
drive_timer() used AsyncTimer::poll() to determine whether a protocol
deadline had elapsed. Under Tokio's cooperative task budget,
Sleep::poll() may return Poll::Pending for an already-expired deadline
once the task's budget is exhausted, which can happen when
process_conn_events() drains a busy channel.
As a result, handle_timeout() is not called even though the deadline has
already elapsed. For QUIC, timers such as PTO, loss detection, and idle
timeouts are correctness-critical and should not be deferred to a later
scheduling round.
Fix this by checking runtime.now() >= deadline before consulting the
async timer. The clock is not subject to cooperative budgeting. The
timer remains responsible only for registering a wakeup when the
deadline lies in the future.1 parent 485f9b6 commit 76020ba
1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1210 | 1220 | | |
1211 | 1221 | | |
1212 | 1222 | | |
| |||
1225 | 1235 | | |
1226 | 1236 | | |
1227 | 1237 | | |
1228 | | - | |
1229 | | - | |
1230 | 1238 | | |
1231 | 1239 | | |
1232 | 1240 | | |
1233 | | - | |
1234 | | - | |
| 1241 | + | |
1235 | 1242 | | |
1236 | 1243 | | |
1237 | 1244 | | |
| |||
0 commit comments