2019-01-13 18:08:41 +00:00
|
|
|
// +build linux netbsd freebsd openbsd dragonflybsd
|
2018-12-05 22:39:04 +00:00
|
|
|
|
2019-03-28 16:13:14 +00:00
|
|
|
package multicast
|
2018-12-05 22:39:04 +00:00
|
|
|
|
|
|
|
import "syscall"
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
|
2020-05-02 22:23:20 +00:00
|
|
|
func (m *Multicast) _multicastStarted() {
|
2019-03-01 19:26:50 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-03-28 16:13:14 +00:00
|
|
|
func (m *Multicast) multicastReuse(network string, address string, c syscall.RawConn) error {
|
2018-12-05 22:39:04 +00:00
|
|
|
var control error
|
|
|
|
var reuseport error
|
|
|
|
|
|
|
|
control = c.Control(func(fd uintptr) {
|
|
|
|
reuseport = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
|
|
|
|
})
|
|
|
|
|
|
|
|
switch {
|
|
|
|
case reuseport != nil:
|
|
|
|
return reuseport
|
|
|
|
default:
|
|
|
|
return control
|
|
|
|
}
|
|
|
|
}
|