From 3217c5012a868220cd43e8f9ca5348050a479ad6 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 1 Feb 2018 14:46:48 +1100 Subject: [PATCH] Code comments --- connection.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connection.go b/connection.go index aea9d49d..29d63a56 100644 --- a/connection.go +++ b/connection.go @@ -485,6 +485,7 @@ func (cn *connection) Bitfield(haves []bool) { cn.sentHaves = append([]bool(nil), haves...) } +// Determines interest and requests to send to a connected peer. func nextRequestState( networkingEnabled bool, currentRequests map[request]struct{}, @@ -615,6 +616,7 @@ func (cn *connection) desiredRequestState() (bool, []request, bool) { 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)) }) -- 2.48.1