status-go/vendor/github.com/anacrolix/torrent/common/upverted_files.go

19 lines
333 B
Go
Raw Normal View History

2022-03-10 09:44:48 +00:00
package common
import (
"github.com/anacrolix/torrent/metainfo"
"github.com/anacrolix/torrent/segments"
)
func LengthIterFromUpvertedFiles(fis []metainfo.FileInfo) segments.LengthIter {
i := 0
return func() (segments.Length, bool) {
if i == len(fis) {
return -1, false
}
l := fis[i].Length
i++
return l, true
}
}