We've already use size==0 to indicate sending until EOF for
poll.SendFile on non-Linux platforms: Windows/*BSD/macOS/Solaris.
Let's harmonize Linux with others, making poll.SendFile on Linux
match its comment.
Change-Id: Ibfe9c9aa8f16bc37812afce9f95995c715cce0bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/623057
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
//
// if handled == false, sendFile performed no work.
func sendFile(c *netFD, r io.Reader) (written int64, err error, handled bool) {
- var remain int64 = 1<<63 - 1 // by default, copy until EOF
+ var remain int64 = 0 // 0 indicates sending until EOF
lr, ok := r.(*io.LimitedReader)
if ok {
}
rerr := sc.Read(func(fd uintptr) (done bool) {
- written, err, handled = poll.SendFile(pfd, int(fd), 1<<63-1)
+ written, err, handled = poll.SendFile(pfd, int(fd), 0)
return true
})
// readFrom is basically a refactor of net.sendFile, but adapted to work for the target of *File.
func (f *File) readFrom(r io.Reader) (written int64, handled bool, err error) {
- var remain int64 = 0
+ var remain int64 = 0 // 0 indicates sending until EOF
lr, ok := r.(*io.LimitedReader)
if ok {
remain, r = lr.N, lr.R