Skip to content

Commit 97781d2

Browse files
alexbrainmanianlancetaylor
authored andcommitted
[release-branch.go1.11] internal/poll: advance file position in windows sendfile
Some versions of Windows (Windows 10 1803) do not set file position after TransmitFile completes. So just use Seek to set file position before returning from sendfile. Fixes #27411 Change-Id: I7a49be10304b5db19dda707b13ac93d338aeb190 Reviewed-on: https://go-review.googlesource.com/131976 Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Yasuhiro MATSUMOTO <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/145779 Run-TryBot: Alex Brainman <[email protected]>
1 parent edb6c16 commit 97781d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/internal/poll/sendfile_windows.go

+6
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,11 @@ func SendFile(fd *FD, src syscall.Handle, n int64) (int64, error) {
3838
done, err := wsrv.ExecIO(o, func(o *operation) error {
3939
return syscall.TransmitFile(o.fd.Sysfd, o.handle, o.qty, 0, &o.o, nil, syscall.TF_WRITE_BEHIND)
4040
})
41+
if err == nil {
42+
// Some versions of Windows (Windows 10 1803) do not set
43+
// file position after TransmitFile completes.
44+
// So just use Seek to set file position.
45+
_, err = syscall.Seek(o.handle, curpos+int64(done), 0)
46+
}
4147
return int64(done), err
4248
}

0 commit comments

Comments
 (0)