Repository navigation
Commit 228c51e
Refactor stdlib web server to remove unnecessary clone and fix lock starvation
This commit refactors the `web.rs` server implementations (lines 401 and 469) to acquire the `PAGE_CONTENT` mutex lock *after* waiting for an incoming request instead of holding it beforehand. This resolves an underlying bug where the server would serve stale content and block other threads while waiting for network I/O, while simultaneously avoiding an unnecessary string clone by dereferencing the mutex guard instead.
Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>1 parent 4c273b1 commit 228c51e
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
402 | 401 | | |
403 | | - | |
| 402 | + | |
| 403 | + | |
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
470 | 469 | | |
471 | | - | |
| 470 | + | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
0 commit comments