Skip to content

Commit 361b1ab

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Mark Freeman <[email protected]>
1 parent 9b6bd64 commit 361b1ab

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/internal/poll/fd_windows.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ type operation struct {
7979
// fields used only by net package
8080
buf syscall.WSABuf
8181
msg windows.WSAMsg
82-
sa syscall.Sockaddr
8382
rsa *syscall.RawSockaddrAny
8483
rsan int32
8584
bufs []syscall.WSABuf
@@ -922,9 +921,8 @@ func (fd *FD) WriteTo(buf []byte, sa syscall.Sockaddr) (int, error) {
922921
// handle zero-byte payload
923922
o := &fd.wop
924923
o.InitBuf(buf)
925-
o.sa = sa
926924
n, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
927-
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, o.sa, &o.o, nil)
925+
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, sa, &o.o, nil)
928926
return qty, err
929927
})
930928
return n, err
@@ -938,9 +936,8 @@ func (fd *FD) WriteTo(buf []byte, sa syscall.Sockaddr) (int, error) {
938936
}
939937
o := &fd.wop
940938
o.InitBuf(b)
941-
o.sa = sa
942939
n, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
943-
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, o.sa, &o.o, nil)
940+
err = syscall.WSASendto(fd.Sysfd, &o.buf, 1, &qty, 0, sa, &o.o, nil)
944941
return qty, err
945942
})
946943
ntotal += int(n)
@@ -1035,9 +1032,8 @@ func (fd *FD) WriteToInet6(buf []byte, sa6 *syscall.SockaddrInet6) (int, error)
10351032
// than in the net package so that it can use fd.wop.
10361033
func (fd *FD) ConnectEx(ra syscall.Sockaddr) error {
10371034
o := &fd.wop
1038-
o.sa = ra
10391035
_, err := fd.execIO(o, func(o *operation) (uint32, error) {
1040-
return 0, ConnectExFunc(fd.Sysfd, o.sa, nil, 0, nil, &o.o)
1036+
return 0, ConnectExFunc(fd.Sysfd, ra, nil, 0, nil, &o.o)
10411037
})
10421038
return err
10431039
}

0 commit comments

Comments
 (0)