Skip to content

Commit 8359b5e

Browse files
committed
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 #25722 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]>
1 parent 09ea3c0 commit 8359b5e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/internal/poll/sendfile_windows.go

Lines changed: 6 additions & 0 deletions
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)