]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Remove unused Torrent.fileIndex
authorMatt Joiner <anacrolix@gmail.com>
Tue, 27 Feb 2024 13:15:14 +0000 (00:15 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 28 Feb 2024 04:44:47 +0000 (15:44 +1100)
torrent.go

index 63bfe7442e900c80acfd3a6451eb4824b66ee92b..e27620f878f6643bcb6963720f5ee2044fa1b5fa 100644 (file)
@@ -34,14 +34,12 @@ import (
        "golang.org/x/exp/maps"
 
        "github.com/anacrolix/torrent/bencode"
-       "github.com/anacrolix/torrent/common"
        "github.com/anacrolix/torrent/internal/check"
        "github.com/anacrolix/torrent/internal/nestedmaps"
        "github.com/anacrolix/torrent/metainfo"
        pp "github.com/anacrolix/torrent/peer_protocol"
        utHolepunch "github.com/anacrolix/torrent/peer_protocol/ut-holepunch"
        request_strategy "github.com/anacrolix/torrent/request-strategy"
-       "github.com/anacrolix/torrent/segments"
        "github.com/anacrolix/torrent/storage"
        "github.com/anacrolix/torrent/tracker"
        typedRoaring "github.com/anacrolix/torrent/typed-roaring"
@@ -91,9 +89,8 @@ type Torrent struct {
        metainfo metainfo.MetaInfo
 
        // The info dict. nil if we don't have it (yet).
-       info      *metainfo.Info
-       fileIndex segments.Index
-       files     *[]*File
+       info  *metainfo.Info
+       files *[]*File
 
        _chunksPerRegularPiece chunkIndexType
 
@@ -457,7 +454,6 @@ func (t *Torrent) setInfo(info *metainfo.Info) error {
        t.nameMu.Unlock()
        t._chunksPerRegularPiece = chunkIndexType((pp.Integer(t.usualPieceSize()) + t.chunkSize - 1) / t.chunkSize)
        t.updateComplete()
-       t.fileIndex = segments.NewIndex(common.LengthIterFromUpvertedFiles(info.UpvertedFiles()))
        t.displayName = "" // Save a few bytes lol.
        t.initFiles()
        t.cacheLength()