RemoveAddress is called when an endpoint is removed
(ipv6 netip.Addr)
| 62 | |
| 63 | // RemoveAddress is called when an endpoint is removed |
| 64 | func (mgr *MCastManager) RemoveAddress(ipv6 netip.Addr) { |
| 65 | if mgr.iface == "" || !ipv6.IsValid() { |
| 66 | return |
| 67 | } |
| 68 | |
| 69 | key := multicast.Address(ipv6).Key() |
| 70 | |
| 71 | mgr.mutex.Lock() |
| 72 | defer mgr.mutex.Unlock() |
| 73 | |
| 74 | if m, ok := mgr.addresses[key]; ok { |
| 75 | delete(m, ipv6) |
| 76 | if len(m) == 0 { |
| 77 | // Last IP that has the solicited node maddr |
| 78 | mgr.leaveGroup(ipv6) |
| 79 | delete(mgr.addresses, key) |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | func (mgr *MCastManager) joinGroup(ipv6 netip.Addr) { |
| 85 | maddr := multicast.Address(ipv6).SolicitedNodeMaddr() |