]> Sergey Matveev's repositories - btrtrc.git/blob - request-strategy/piece.go
Don't always force piece reallocation
[btrtrc.git] / request-strategy / piece.go
1 package request_strategy
2
3 import (
4         "github.com/anacrolix/torrent/types"
5 )
6
7 type ChunksIter func(func(types.ChunkSpec))
8
9 type Piece struct {
10         Request           bool
11         Priority          piecePriority
12         Partial           bool
13         Availability      int64
14         Length            int64
15         NumPendingChunks  int
16         IterPendingChunks ChunksIter
17 }
18
19 func (p Piece) iterPendingChunksWrapper(f func(ChunkSpec)) {
20         i := p.IterPendingChunks
21         if i != nil {
22                 i(f)
23         }
24 }