Skip to content

Commit

Permalink
internal/poll, net: use (*FD).SetsockoptInet4Addr in setIPv4Multicast…
Browse files Browse the repository at this point in the history
…Interface on windows

Change-Id: Ic29d15bf62d8e693ca969354b415d958823bf41d
Reviewed-on: https://go-review.googlesource.com/c/go/+/523915
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Tobias Klauser <[email protected]>
Auto-Submit: Tobias Klauser <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
  • Loading branch information
tklauser authored and neild committed Aug 30, 2023
1 parent a8d45a7 commit fc486e4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
9 changes: 0 additions & 9 deletions src/internal/poll/sockopt_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ package poll

import "syscall"

// Setsockopt wraps the setsockopt network call.
func (fd *FD) Setsockopt(level, optname int32, optval *byte, optlen int32) error {
if err := fd.incref(); err != nil {
return err
}
defer fd.decref()
return syscall.Setsockopt(fd.Sysfd, level, optname, optval, optlen)
}

// WSAIoctl wraps the WSAIoctl network call.
func (fd *FD) WSAIoctl(iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *syscall.Overlapped, completionRoutine uintptr) error {
if err := fd.incref(); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions src/net/sockoptip_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"
"runtime"
"syscall"
"unsafe"
)

func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
Expand All @@ -18,7 +17,7 @@ func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
}
var a [4]byte
copy(a[:], ip.To4())
err = fd.pfd.Setsockopt(syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, (*byte)(unsafe.Pointer(&a[0])), 4)
err = fd.pfd.SetsockoptInet4Addr(syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, a)
runtime.KeepAlive(fd)
return wrapSyscallError("setsockopt", err)
}
Expand Down

0 comments on commit fc486e4

Please sign in to comment.