mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
internal/poll: remove rsan field from Windows' poll.operation
There is no need to keep the rsan field in the poll.operation struct. This skims down the size of os.File by 16 bytes. Change-Id: I5e99e0e87178b63a19f0b9883b7b3d25abfd9ec3 Reviewed-on: https://go-review.googlesource.com/c/go/+/685417 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Mark Freeman <mark@golang.org>
This commit is contained in:
parent
361b1ab41f
commit
d7b4114346
1 changed files with 10 additions and 10 deletions
|
|
@ -80,7 +80,6 @@ type operation struct {
|
||||||
buf syscall.WSABuf
|
buf syscall.WSABuf
|
||||||
msg windows.WSAMsg
|
msg windows.WSAMsg
|
||||||
rsa *syscall.RawSockaddrAny
|
rsa *syscall.RawSockaddrAny
|
||||||
rsan int32
|
|
||||||
bufs []syscall.WSABuf
|
bufs []syscall.WSABuf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -668,9 +667,9 @@ func (fd *FD) ReadFrom(buf []byte) (int, syscall.Sockaddr, error) {
|
||||||
if o.rsa == nil {
|
if o.rsa == nil {
|
||||||
o.rsa = new(syscall.RawSockaddrAny)
|
o.rsa = new(syscall.RawSockaddrAny)
|
||||||
}
|
}
|
||||||
o.rsan = int32(unsafe.Sizeof(*o.rsa))
|
rsan := int32(unsafe.Sizeof(*o.rsa))
|
||||||
var flags uint32
|
var flags uint32
|
||||||
err = syscall.WSARecvFrom(fd.Sysfd, &o.buf, 1, &qty, &flags, o.rsa, &o.rsan, &o.o, nil)
|
err = syscall.WSARecvFrom(fd.Sysfd, &o.buf, 1, &qty, &flags, o.rsa, &rsan, &o.o, nil)
|
||||||
return qty, err
|
return qty, err
|
||||||
})
|
})
|
||||||
err = fd.eofError(n, err)
|
err = fd.eofError(n, err)
|
||||||
|
|
@ -699,9 +698,9 @@ func (fd *FD) ReadFromInet4(buf []byte, sa4 *syscall.SockaddrInet4) (int, error)
|
||||||
if o.rsa == nil {
|
if o.rsa == nil {
|
||||||
o.rsa = new(syscall.RawSockaddrAny)
|
o.rsa = new(syscall.RawSockaddrAny)
|
||||||
}
|
}
|
||||||
o.rsan = int32(unsafe.Sizeof(*o.rsa))
|
rsan := int32(unsafe.Sizeof(*o.rsa))
|
||||||
var flags uint32
|
var flags uint32
|
||||||
err = syscall.WSARecvFrom(fd.Sysfd, &o.buf, 1, &qty, &flags, o.rsa, &o.rsan, &o.o, nil)
|
err = syscall.WSARecvFrom(fd.Sysfd, &o.buf, 1, &qty, &flags, o.rsa, &rsan, &o.o, nil)
|
||||||
return qty, err
|
return qty, err
|
||||||
})
|
})
|
||||||
err = fd.eofError(n, err)
|
err = fd.eofError(n, err)
|
||||||
|
|
@ -730,9 +729,9 @@ func (fd *FD) ReadFromInet6(buf []byte, sa6 *syscall.SockaddrInet6) (int, error)
|
||||||
if o.rsa == nil {
|
if o.rsa == nil {
|
||||||
o.rsa = new(syscall.RawSockaddrAny)
|
o.rsa = new(syscall.RawSockaddrAny)
|
||||||
}
|
}
|
||||||
o.rsan = int32(unsafe.Sizeof(*o.rsa))
|
rsan := int32(unsafe.Sizeof(*o.rsa))
|
||||||
var flags uint32
|
var flags uint32
|
||||||
err = syscall.WSARecvFrom(fd.Sysfd, &o.buf, 1, &qty, &flags, o.rsa, &o.rsan, &o.o, nil)
|
err = syscall.WSARecvFrom(fd.Sysfd, &o.buf, 1, &qty, &flags, o.rsa, &rsan, &o.o, nil)
|
||||||
return qty, err
|
return qty, err
|
||||||
})
|
})
|
||||||
err = fd.eofError(n, err)
|
err = fd.eofError(n, err)
|
||||||
|
|
@ -1040,10 +1039,11 @@ func (fd *FD) ConnectEx(ra syscall.Sockaddr) error {
|
||||||
|
|
||||||
func (fd *FD) acceptOne(s syscall.Handle, rawsa []syscall.RawSockaddrAny, o *operation) (string, error) {
|
func (fd *FD) acceptOne(s syscall.Handle, rawsa []syscall.RawSockaddrAny, o *operation) (string, error) {
|
||||||
// Submit accept request.
|
// Submit accept request.
|
||||||
o.rsan = int32(unsafe.Sizeof(rawsa[0]))
|
rsan := uint32(unsafe.Sizeof(rawsa[0]))
|
||||||
_, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
|
_, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
|
||||||
err = AcceptFunc(fd.Sysfd, s, (*byte)(unsafe.Pointer(&rawsa[0])), 0, uint32(o.rsan), uint32(o.rsan), &qty, &o.o)
|
err = AcceptFunc(fd.Sysfd, s, (*byte)(unsafe.Pointer(&rawsa[0])), 0, rsan, rsan, &qty, &o.o)
|
||||||
return qty, err
|
return qty, err
|
||||||
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
CloseFunc(s)
|
CloseFunc(s)
|
||||||
|
|
@ -1078,7 +1078,7 @@ func (fd *FD) Accept(sysSocket func() (syscall.Handle, error)) (syscall.Handle,
|
||||||
|
|
||||||
errcall, err := fd.acceptOne(s, rawsa[:], o)
|
errcall, err := fd.acceptOne(s, rawsa[:], o)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return s, rawsa[:], uint32(o.rsan), "", nil
|
return s, rawsa[:], uint32(unsafe.Sizeof(rawsa[0])), "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sometimes we see WSAECONNRESET and ERROR_NETNAME_DELETED is
|
// Sometimes we see WSAECONNRESET and ERROR_NETNAME_DELETED is
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue