internal/poll: remove sa field from Windows' poll.operation

There is no need to keep the sa field in the poll.operation struct.

This skims down the size of os.File by 32 bytes.

Change-Id: I6b021a76f582ead5dccb29b001e7a5b068a2c2ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/685416
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
This commit is contained in:
qmuntal 2025-07-02 12:40:29 +02:00 committed by Quim Muntal
parent 9b6bd64e46
commit 361b1ab41f

View file

@ -79,7 +79,6 @@ type operation struct {
// fields used only by net package
buf syscall.WSABuf
msg windows.WSAMsg
sa syscall.Sockaddr
rsa *syscall.RawSockaddrAny
rsan int32
bufs []syscall.WSABuf
@ -922,9 +921,8 @@ func (fd *FD) WriteTo(buf []byte, sa syscall.Sockaddr) (int, error) {
// handle zero-byte payload
o := &fd.wop
o.InitBuf(buf)
o.sa = sa
n, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, o.sa, &o.o, nil)
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, sa, &o.o, nil)
return qty, err
})
return n, err
@ -938,9 +936,8 @@ func (fd *FD) WriteTo(buf []byte, sa syscall.Sockaddr) (int, error) {
}
o := &fd.wop
o.InitBuf(b)
o.sa = sa
n, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, o.sa, &o.o, nil)
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, sa, &o.o, nil)
return qty, err
})
ntotal += int(n)
@ -1035,9 +1032,8 @@ func (fd *FD) WriteToInet6(buf []byte, sa6 *syscall.SockaddrInet6) (int, error)
// than in the net package so that it can use fd.wop.
func (fd *FD) ConnectEx(ra syscall.Sockaddr) error {
o := &fd.wop
o.sa = ra
_, err := fd.execIO(o, func(o *operation) (uint32, error) {
return 0, ConnectExFunc(fd.Sysfd, o.sa, nil, 0, nil, &o.o)
return 0, ConnectExFunc(fd.Sysfd, ra, nil, 0, nil, &o.o)
})
return err
}