Skip to content

Commit fc486e4

Browse files
tklauserneild
authored andcommitted
internal/poll, net: use (*FD).SetsockoptInet4Addr in setIPv4MulticastInterface 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]>
1 parent a8d45a7 commit fc486e4

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/internal/poll/sockopt_windows.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ package poll
66

77
import "syscall"
88

9-
// Setsockopt wraps the setsockopt network call.
10-
func (fd *FD) Setsockopt(level, optname int32, optval *byte, optlen int32) error {
11-
if err := fd.incref(); err != nil {
12-
return err
13-
}
14-
defer fd.decref()
15-
return syscall.Setsockopt(fd.Sysfd, level, optname, optval, optlen)
16-
}
17-
189
// WSAIoctl wraps the WSAIoctl network call.
1910
func (fd *FD) WSAIoctl(iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *syscall.Overlapped, completionRoutine uintptr) error {
2011
if err := fd.incref(); err != nil {

src/net/sockoptip_windows.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"os"
99
"runtime"
1010
"syscall"
11-
"unsafe"
1211
)
1312

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

0 commit comments

Comments
 (0)