From 005ca8124ad94dc8416d70ec7f1549d536f94a7c Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 3 Jun 2015 22:43:40 +1000 Subject: [PATCH] Fix rare single-torrent stall due to obsolete ceaseNetworking call Only occurred if you have a data backend that can drop completed pieces, and it happened that you wanted to redownload data that had been dropped after completely downloading the torrent in the past. --- client.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index b21fb522..06c1652e 100644 --- a/client.go +++ b/client.go @@ -337,8 +337,8 @@ func (t *torrent) connPendPiece(c *connection, piece int) { func (cl *Client) raisePiecePriority(t *torrent, piece int, priority piecePriority) { if t.Pieces[piece].Priority < priority { - cl.event.Broadcast() cl.prioritizePiece(t, piece, priority) + cl.event.Broadcast() } } @@ -2552,6 +2552,7 @@ func (me *Client) pieceHashed(t *torrent, piece pp.Integer, correct bool) { func (me *Client) pieceChanged(t *torrent, piece int) { correct := t.pieceComplete(piece) p := t.Pieces[piece] + defer p.Event.Broadcast() if correct { p.Priority = PiecePriorityNone p.PendingChunkSpecs = nil @@ -2560,7 +2561,6 @@ func (me *Client) pieceChanged(t *torrent, piece int) { delete(t.urgent, req) } } - p.Event.Broadcast() } else { if p.numPendingChunks() == 0 { t.pendAllChunkSpecs(int(piece)) @@ -2588,9 +2588,6 @@ func (me *Client) pieceChanged(t *torrent, piece int) { me.replenishConnRequests(t, conn) } } - if t.haveAllPieces() && me.config.NoUpload { - t.ceaseNetworking() - } me.event.Broadcast() } -- 2.48.1