).Int(
i.Key.Index, j.Key.Index,
).Lazy(func() multiless.Computation {
- return multiless.New().Cmp(bytes.Compare(
- i.Key.InfoHash[:],
- j.Key.InfoHash[:],
- ))
+ a := i.Key.InfoHash.Value()
+ b := j.Key.InfoHash.Value()
+ return multiless.New().Cmp(bytes.Compare(a[:], b[:]))
})
}
maxUnverifiedBytes = input.MaxUnverifiedBytes()
)
pro.tree.Scan(func(item PieceRequestOrderItem) bool {
- ih := item.Key.InfoHash
+ ih := item.Key.InfoHash.Value()
t := input.Torrent(ih)
piece := t.Piece(item.Key.Index)
pieceLength := t.PieceLength()
import (
"iter"
+ "unique"
g "github.com/anacrolix/generics"
}
type PieceRequestOrderKey struct {
+ InfoHash unique.Handle[metainfo.Hash]
Index int
- InfoHash metainfo.Hash
}
type PieceRequestOrderState struct {
func (t *Torrent) pieceRequestOrderKey(i int) request_strategy.PieceRequestOrderKey {
return request_strategy.PieceRequestOrderKey{
- InfoHash: *t.canonicalShortInfohash(),
+ InfoHash: unique.Make(*t.canonicalShortInfohash()),
Index: i,
}
}