From 9ed8ead2e1fa30ac46581e05d54b71afe007fe58 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 13 Jun 2016 00:49:40 +0200 Subject: wip --- meta/torrent.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'meta') diff --git a/meta/torrent.go b/meta/torrent.go index d30dc48..9b1b124 100644 --- a/meta/torrent.go +++ b/meta/torrent.go @@ -3,6 +3,7 @@ package meta import ( "errors" "fmt" + "os" "path" "time" ) @@ -36,6 +37,15 @@ func (i Info) FullPath(n int) (string, error) { return path.Join(p...), nil } +// piece-to-file mapping: +// piece # -> [ { file #, off, len }, ... ] + +type pieceToFile map[int][]struct { + fd os.File + offset int + length int +} + func (i Info) FindFile(chunk, offset int) int { if i.isSingleFile() { return 0 -- cgit v1.2.3