diff --git a/src/net/sendfile_linux.go b/src/net/sendfile_linux.go index f8a7bec8d3..75af617416 100644 --- a/src/net/sendfile_linux.go +++ b/src/net/sendfile_linux.go @@ -20,7 +20,7 @@ const supportsSendfile = true // // 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 { diff --git a/src/os/zero_copy_linux.go b/src/os/zero_copy_linux.go index 0c9a8beb7e..27a0882560 100644 --- a/src/os/zero_copy_linux.go +++ b/src/os/zero_copy_linux.go @@ -28,7 +28,7 @@ func (f *File) writeTo(w io.Writer) (written int64, handled bool, err error) { } 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 }) diff --git a/src/os/zero_copy_solaris.go b/src/os/zero_copy_solaris.go index 7fc9ebdada..94a8de6062 100644 --- a/src/os/zero_copy_solaris.go +++ b/src/os/zero_copy_solaris.go @@ -17,7 +17,7 @@ func (f *File) writeTo(w io.Writer) (written int64, handled bool, err error) { // 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