]> Sergey Matveev's repositories - btrtrc.git/blobdiff - piece.go
Add Piece.UpdateCompletion() method
[btrtrc.git] / piece.go
index d2211aa0ed040d22dbc351d369840fce59b31757..f112e0bd262c4f194628a54f94af8aa528258090 100644 (file)
--- a/piece.go
+++ b/piece.go
@@ -239,6 +239,12 @@ func (p *Piece) uncachedPriority() (ret piecePriority) {
        return
 }
 
+func (p *Piece) UpdateCompletion() {
+       p.t.cl.lock()
+       defer p.t.cl.unlock()
+       p.t.updatePieceCompletion(p.index)
+}
+
 func (p *Piece) completion() (ret storage.Completion) {
        ret.Complete = p.t.pieceComplete(p.index)
        ret.Ok = p.storageCompletionOk