Commit 20cab38
Exit cleanly on Ctrl-C
Connection threads inherited ThreadingMixIn's default daemon_threads =
False. Because RangeHandler forces HTTP/1.1, browsers hold keep-alive
connections open, leaving worker threads blocked in recv(). On Ctrl-C
the interpreter waited on those non-daemon threads forever, so the
process printed "Goodbye" but never exited (issue #1).
Mark connection threads as daemons so they cannot block shutdown, and
close the listening socket in a finally block.
Closes #1
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 5be9108 commit 20cab38
2 files changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
| 324 | + | |
| 325 | + | |
320 | 326 | | |
321 | 327 | | |
322 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
0 commit comments