Skip to content

Commit

Permalink
Fix rare single-torrent stall due to obsolete ceaseNetworking call
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anacrolix committed Jun 3, 2015
1 parent 9f94ca7 commit 005ca81
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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()
}

Expand Down

0 comments on commit 005ca81

Please sign in to comment.