]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add a comment about not discarding in webseed OK response bodies
authorMatt Joiner <anacrolix@gmail.com>
Sun, 14 Nov 2021 03:01:46 +0000 (14:01 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 14 Nov 2021 03:01:46 +0000 (14:01 +1100)
webseed/client.go

index a98940e6bdcae50c8ff42d37ec7a6b7ca04fa9c3..5dc9d2c46a726f7fd66ec35f544503d9f4a0b3f3 100644 (file)
@@ -144,6 +144,10 @@ func recvPartResult(ctx context.Context, buf io.Writer, part requestPart) error
                                        part.req.URL,
                                        part.req.Header.Get("Range"))
                        }
+                       // Instead of discarding, we could try receiving all the chunks present in the response
+                       // body. I don't know how one would handle multiple chunk requests resulting in an OK
+                       // response for the same file. The request algorithm might be need to be smarter for
+                       // that.
                        discarded, _ := io.CopyN(io.Discard, result.resp.Body, part.e.Start)
                        if discarded != 0 {
                                log.Printf("discarded %v bytes in webseed request response part", discarded)