if !t.haveInfo() {
return true
}
- for i := range t.Pieces {
- if t.wantPiece(i) {
+ if len(t.urgent) != 0 {
+ return true
+ }
+ for _, p := range t.Pieces {
+ if p.Priority != PiecePriorityNone {
return true
}
}
}
}
conn.pieceRequestOrder.DeletePiece(int(piece))
- }
- if t.wantPiece(piece) && conn.PeerHasPiece(piece) {
+ } else if t.wantPiece(piece) && conn.PeerHasPiece(piece) {
t.connPendPiece(conn, int(piece))
me.replenishConnRequests(t, conn)
}
if p.QueuedForHash || p.Hashing {
ret.Checking = true
}
- if t.piecePartiallyDownloaded(index) {
+ if !ret.Complete && t.piecePartiallyDownloaded(index) {
ret.Partial = true
}
return
if !t.haveInfo() {
return false
}
+ if t.pieceComplete(int(r.Index)) {
+ return true
+ }
p := t.Pieces[r.Index]
+ if p.PendingChunkSpecs == nil {
+ return false
+ }
return !p.pendingChunk(r.chunkSpec, t.chunkSize)
}