Skip to content

Commit

Permalink
dont continue downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
majestrate committed Aug 8, 2017
1 parent bbd38df commit df3de31
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/xd/lib/bittorrent/swarm/piece.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (pt *pieceTracker) nextRequestForDownload(remote *bittorrent.Bitfield) (r *
idx := pt.pendingPiece(remote)
cp, has := pt.requests[idx]
if !has {
if pt.st.Bitfield().Has(idx) {
pt.mtx.Unlock()
return
}
cp = pt.newPiece(idx)
pt.requests[idx] = cp
}
Expand Down

0 comments on commit df3de31

Please sign in to comment.