Commit fab369a
fix: data race in BenchmarkConnectionMainReadLoop (#1040)
_pendingPieces.Add(0) was called without holding the client lock and
without updating the piece request order, causing two issues:
1. Data race with timer goroutines accessing the roaring bitmap
2. Panic in checkPendingPiecesMatchesRequestOrder due to _pendingPieces
and requestOrder being out of sync
Replace the direct bitmap manipulation with updatePiecePriority(0, ...)
which properly updates both _pendingPieces and the piece request order
while holding the client lock.
Co-authored-by: info@weblogix.biz <admin@10gbps.weblogix.it>
Co-authored-by: Matt Joiner <anacrolix@gmail.com>1 parent c3b35bb commit fab369a
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| |||
0 commit comments