Log errant unwanted piece rather than panic

Eventually I'll work out what causes this, but for now it's incredibly rare.
This commit is contained in:
Matt Joiner 2015-08-04 01:29:40 +10:00
parent 5a73f73d97
commit da8ac9fe01
1 changed files with 3 additions and 1 deletions

View File

@ -2480,7 +2480,9 @@ func (me *Client) fillRequests(t *torrent, c *connection) {
panic("piece in request order but peer doesn't have it")
}
if !t.wantPiece(pieceIndex) {
panic("unwanted piece in connection request order")
log.Printf("unwanted piece %d in connection request order\n%s", pieceIndex, c)
c.pieceRequestOrder.DeletePiece(pieceIndex)
continue
}
piece := t.Pieces[pieceIndex]
for _, cs := range piece.shuffledPendingChunkSpecs(t.pieceLength(pieceIndex), pp.Integer(t.chunkSize)) {