clientConfig.NoDHT = !flags.Dht
clientConfig.Debug = flags.Debug
clientConfig.Seed = flags.Seed
- clientConfig.PublicIp4 = flags.PublicIP
+ clientConfig.PublicIp4 = flags.PublicIP.To4()
clientConfig.PublicIp6 = flags.PublicIP
clientConfig.DisablePEX = !flags.Pex
clientConfig.DisableWebtorrent = !flags.Webtorrent
t *Torrent
}
-func (r requestStrategyTorrent) Piece(i int) request_strategy.Piece {
- return requestStrategyPiece{r.t, i}
+func (r requestStrategyTorrent) IgnorePiece(i int) bool {
+ if r.t.ignorePieceForRequests(i) {
+ return true
+ }
+ if r.t.pieceNumPendingChunks(i) == 0 {
+ return true
+ }
+
+ return false
}
func (r requestStrategyTorrent) ChunksPerPiece() uint32 {
pro.tree.Scan(func(_i pieceRequestOrderItem) bool {
ih := _i.key.InfoHash
var t Torrent = input.Torrent(ih)
- var piece Piece = t.Piece(_i.key.Index)
pieceLength := t.PieceLength()
if storageLeft != nil {
if *storageLeft < pieceLength {
}
*storageLeft -= pieceLength
}
- if !piece.Request() || piece.NumPendingChunks() == 0 {
+ if t.IgnorePiece(_i.key.Index) {
// TODO: Clarify exactly what is verified. Stuff that's being hashed should be
// considered unverified and hold up further requests.
return true
package request_strategy
type Torrent interface {
- Piece(int) Piece
+ IgnorePiece(int) bool
ChunksPerPiece() uint32
PieceLength() int64
}