aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-07-04 12:50:51 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-07-04 12:50:51 +0200
commita2a73d6845f6a58e58b46e8c6f198808791c65b3 (patch)
treec67ba926c63fd6a0afa8d94f51a0c6c273dc21e2
parent3c9e4fa540fed16aaa823b1bb813bb73faebb575 (diff)
wip
-rw-r--r--meta/torrent.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/meta/torrent.go b/meta/torrent.go
index 9720b34..64fe34c 100644
--- a/meta/torrent.go
+++ b/meta/torrent.go
@@ -35,8 +35,10 @@ type Info struct {
}
func (i Info) pieces() []Piece {
- for _, f := range i.Files {
- i.Length += f.Length
+ if i.Length == 0 {
+ for _, f := range i.Files {
+ i.Length += f.Length
+ }
}
n := i.Length / i.PieceLength
l := i.Length % i.PieceLength
@@ -196,7 +198,6 @@ func (i Info) String() string {
panic(err)
}
s += fmt.Sprintf(" %s (%d)\n", p, f.Length)
- i.Length += f.Length
}
}
s += fmt.Sprintf("%s (%d) ", i.Name, i.Length)