Commit 0a6a952
Matt Curtis
Fix "None-None" race condition with keep-alive timeout
Keep-alives are handled by a scheduled routine, which closes the
connection if the keep-alive has expired. The routine calculates the
keep-alive time remaining based on the last response time, but that's
not set until after the routine is scheduled, creating a race
condition. The fix is to set the last response time before scheduling
the keep-alive routine. Additionally the calculation is a bit more
robust now, so the scheduled routine doesn't need to deal with None.
The async code is largely imported from [sanic](https://github.com/huge-success/sanic),
modified and stripped-down to reduce cold start times.
Addresses issue #1031 parent 16da49a commit 0a6a952
3 files changed
Lines changed: 60 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
| |||
236 | 245 | | |
237 | 246 | | |
238 | 247 | | |
239 | | - | |
240 | | - | |
241 | | - | |
| 248 | + | |
| 249 | + | |
242 | 250 | | |
243 | 251 | | |
244 | 252 | | |
| |||
431 | 439 | | |
432 | 440 | | |
433 | 441 | | |
| 442 | + | |
434 | 443 | | |
435 | 444 | | |
436 | 445 | | |
437 | | - | |
438 | 446 | | |
439 | 447 | | |
440 | 448 | | |
| |||
483 | 491 | | |
484 | 492 | | |
485 | 493 | | |
| 494 | + | |
486 | 495 | | |
487 | 496 | | |
488 | 497 | | |
489 | | - | |
490 | 498 | | |
491 | 499 | | |
492 | 500 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments