Add some sanity checks to priorities extracted from Torrent.pendingPieces

This commit is contained in:
Matt Joiner 2018-01-29 18:21:37 +11:00
parent 50c1cdb601
commit ceaf5a2360
1 changed files with 8 additions and 1 deletions

View File

@ -999,7 +999,14 @@ func (t *Torrent) piecePriority(piece int) piecePriority {
if !ok {
return PiecePriorityNone
}
return piecePriority(-prio)
if prio > 0 {
panic(prio)
}
ret := piecePriority(-prio)
if ret == PiecePriorityNone {
panic(piece)
}
return ret
}
func (t *Torrent) pendRequest(req request) {