cn.sentHaves = append([]bool(nil), haves...)
}
+// Determines interest and requests to send to a connected peer.
func nextRequestState(
networkingEnabled bool,
currentRequests map[request]struct{},
func undirtiedChunks(piece int, t *Torrent, f func(chunkSpec) bool) bool {
chunkIndices := t.pieces[piece].undirtiedChunkIndices().ToSortedSlice()
+ // TODO: Use "math/rand".Shuffle >= Go 1.10
return iter.ForPerm(len(chunkIndices), func(i int) bool {
return f(t.chunkIndexSpec(chunkIndices[i], piece))
})