aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/piece.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/meta/piece.go b/meta/piece.go
index 58b87af..35588a6 100644
--- a/meta/piece.go
+++ b/meta/piece.go
@@ -6,12 +6,10 @@ type Piece struct {
Offset int
Length int
Sum [sha1.Size]byte
+ Ok bool
}
-func (p Piece) Check(b []byte) bool {
- return sha1.Sum(b) == p.Sum
-}
-
-func (p Piece) Size() int {
- return p.Length
+func (p *Piece) Check(b []byte) bool {
+ p.Ok = sha1.Sum(b) == p.Sum
+ return p.Ok
}