mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 15:20:30 +00:00
multicast, use the prebuilt interface map when checking active listeners (#707)
This commit is contained in:
parent
48f008a8e2
commit
33e3679458
@ -259,11 +259,8 @@ func (m *Multicast) _announce() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Find the interface that matches the listener
|
// Find the interface that matches the listener
|
||||||
if intf, err := net.InterfaceByName(name); err == nil {
|
if info, ok := m._interfaces[name]; ok {
|
||||||
if addrs, err := intf.Addrs(); err == nil {
|
for _, addr := range info.addrs {
|
||||||
// Loop through the addresses attached to that listener and see if any
|
|
||||||
// of them match the current address of the listener
|
|
||||||
for _, addr := range addrs {
|
|
||||||
if ip, _, err := net.ParseCIDR(addr.String()); err == nil {
|
if ip, _, err := net.ParseCIDR(addr.String()); err == nil {
|
||||||
// Does the interface address match our listener address?
|
// Does the interface address match our listener address?
|
||||||
if ip.Equal(listenaddr.IP) {
|
if ip.Equal(listenaddr.IP) {
|
||||||
@ -273,7 +270,6 @@ func (m *Multicast) _announce() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// If the address has not been found on the adapter then we should stop
|
// If the address has not been found on the adapter then we should stop
|
||||||
// and clean up the TCP listener. A new one will be created below if a
|
// and clean up the TCP listener. A new one will be created below if a
|
||||||
// suitable link-local address is found
|
// suitable link-local address is found
|
||||||
|
Loading…
Reference in New Issue
Block a user