From: Matt Joiner Date: Mon, 3 Aug 2015 15:29:40 +0000 (+1000) Subject: Log errant unwanted piece rather than panic X-Git-Tag: v1.0.0~1084 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=da8ac9fe018c0a031febb285c609eb8e85d90026;p=btrtrc.git Log errant unwanted piece rather than panic Eventually I'll work out what causes this, but for now it's incredibly rare. --- diff --git a/client.go b/client.go index ec3f94dc..8760c283 100644 --- a/client.go +++ b/client.go @@ -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)) {