Commit 2b8c417
committed
fix(tunnel-node): eliminate atomic buf_len race in reader_task
Bind the read_buf MutexGuard to a variable and store
buf_guard.len() while the lock is held, replacing the
previously-unlocked fetch_add. A concurrent drain_now()
could otherwise acquire the lock, drain the buffer, and
store(0) between extend_from_slice and fetch_add,
leaving buf_len inflated until the next drain.1 parent 4a6332e commit 2b8c417
1 file changed
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
321 | 318 | | |
322 | 319 | | |
323 | 320 | | |
| |||
0 commit comments