From ff11917fa8bc7078a6fe452ec82b25b711b7fb88 Mon Sep 17 00:00:00 2001 From: whr819987540 <819987540@qq.com> Date: Thu, 27 Apr 2023 10:38:37 +0800 Subject: [PATCH] add comment to ChoosePieceLength --- metainfo/piece-length.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metainfo/piece-length.go b/metainfo/piece-length.go index 183b4d86..c483e037 100644 --- a/metainfo/piece-length.go +++ b/metainfo/piece-length.go @@ -41,6 +41,9 @@ const ( const targetPieceCountMax = targetPieceCountMin << 1 // Choose a good piecelength. +// piecelength >= 16KB +// piecelength = 16KB*X +// totalLength / piecelength = piecenumber < 2048 func ChoosePieceLength(totalLength int64) (pieceLength int64) { // Must be a power of 2. // Must be a multiple of 16KB