]> Cypherpunks repositories - gostls13.git/commit
internal/poll: keep copying after successful Sendfile return on BSD
authorDamien Neil <dneil@google.com>
Wed, 23 Oct 2024 23:01:08 +0000 (16:01 -0700)
committerDamien Neil <dneil@google.com>
Thu, 24 Oct 2024 01:18:06 +0000 (01:18 +0000)
commitbd388c0216bcb33d7325b0ad9722a3be8155a289
treebebbaba2abc0a40995843ccad638125d217f08ee
parent28b09d5846da23ed3b8d2b2a93eca5ae94ce43f8
internal/poll: keep copying after successful Sendfile return on BSD

The BSD implementation of poll.SendFile incorrectly halted
copying after succesfully writing one full chunk of data.
Adjust the copy loop to match the Linux and Solaris
implementations.

In testing, empirically macOS appears to sometimes return
EAGAIN from sendfile after successfully copying a full
chunk. Add a check to all implementations to return nil
after successfully copying all data if the last sendfile
call returns EAGAIN.

For #70000

Change-Id: I57ba649491fc078c7330310b23e1cfd85135c8ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/622235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/internal/poll/sendfile_bsd.go
src/internal/poll/sendfile_linux.go
src/internal/poll/sendfile_solaris.go
src/os/copy_test.go [new file with mode: 0644]
src/os/readfrom_linux_test.go