Commit c1e903b
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 b3b20e1 commit c1e903b
1 file changed
Lines changed: 24 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1157 | 1157 | | |
1158 | 1158 | | |
1159 | 1159 | | |
1160 | | - | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1181 | 1180 | | |
1182 | 1181 | | |
1183 | | - | |
1184 | | - | |
| 1182 | + | |
1185 | 1183 | | |
| 1184 | + | |
1186 | 1185 | | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
| 1186 | + | |
1191 | 1187 | | |
1192 | 1188 | | |
1193 | 1189 | | |
1194 | 1190 | | |
1195 | 1191 | | |
1196 | 1192 | | |
1197 | 1193 | | |
1198 | | - | |
1199 | | - | |
1200 | 1194 | | |
1201 | 1195 | | |
1202 | 1196 | | |
1203 | | - | |
1204 | | - | |
| 1197 | + | |
1205 | 1198 | | |
1206 | 1199 | | |
1207 | 1200 | | |
| |||
0 commit comments