fixes anacrolix/torrent#795 (#807)

This commit is contained in:
Pavel Tatarskiy 2023-05-19 07:23:34 +03:00 committed by GitHub
parent 56c8b396f5
commit e6a38b1cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -8,9 +8,11 @@ func (t *Torrent) updatePieceRequestOrder(pieceIndex int) {
if t.storage == nil {
return
}
t.cl.pieceRequestOrder[t.clientPieceRequestOrderKey()].Update(
t.pieceRequestOrderKey(pieceIndex),
t.requestStrategyPieceOrderState(pieceIndex))
if ro, ok := t.cl.pieceRequestOrder[t.clientPieceRequestOrderKey()]; ok {
ro.Update(
t.pieceRequestOrderKey(pieceIndex),
t.requestStrategyPieceOrderState(pieceIndex))
}
}
func (t *Torrent) clientPieceRequestOrderKey() interface{} {