mirror of
https://github.com/golang/go
synced 2024-11-22 04:04:40 -07:00
parent
946e2543f8
commit
0226690a9b
@ -208,25 +208,10 @@ func (fd *netFD) listenStream(laddr sockaddr, backlog int, ctrlFn func(string, s
|
||||
func (fd *netFD) listenDatagram(laddr sockaddr, ctrlFn func(string, string, syscall.RawConn) error) error {
|
||||
switch addr := laddr.(type) {
|
||||
case *UDPAddr:
|
||||
// We provide a socket that listens to a wildcard
|
||||
// address with reusable UDP port when the given laddr
|
||||
// is an appropriate UDP multicast address prefix.
|
||||
// This makes it possible for a single UDP listener to
|
||||
// join multiple different group addresses, for
|
||||
// multiple UDP listeners that listen on the same UDP
|
||||
// port to join the same group address.
|
||||
if addr.IP != nil && addr.IP.IsMulticast() {
|
||||
if err := setDefaultMulticastSockopts(fd.pfd.Sysfd); err != nil {
|
||||
return err
|
||||
}
|
||||
addr := *addr
|
||||
switch fd.family {
|
||||
case syscall.AF_INET:
|
||||
addr.IP = IPv4zero
|
||||
case syscall.AF_INET6:
|
||||
addr.IP = IPv6unspecified
|
||||
}
|
||||
laddr = &addr
|
||||
}
|
||||
}
|
||||
var err error
|
||||
|
Loading…
Reference in New Issue
Block a user