]> Sergey Matveev's repositories - btrtrc.git/blobdiff - piece.go
Add File.Cancel
[btrtrc.git] / piece.go
index 16f20653fd2b5f7df918e6554dfd7784fdf63870..a56225c1ec7ca947ce97002676abc9460abc4377 100644 (file)
--- a/piece.go
+++ b/piece.go
@@ -52,6 +52,15 @@ func (p *piece) pendingChunk(cs chunkSpec, chunkSize pp.Integer) bool {
        return !p.DirtyChunks[ci]
 }
 
+func (p *piece) hasDirtyChunks() bool {
+       for _, dirty := range p.DirtyChunks {
+               if dirty {
+                       return true
+               }
+       }
+       return false
+}
+
 func (p *piece) numDirtyChunks() (ret int) {
        for _, dirty := range p.DirtyChunks {
                if dirty {