libnetwork: change netWatch map to a set

The map keys are only tested for presence. The value stored at the keys
is unused.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider 2023-10-17 18:26:34 -04:00
parent 0456c0db87
commit 29da565133

View file

@ -185,7 +185,7 @@ retry:
} }
type netWatch struct { type netWatch struct {
localEps map[string]*Endpoint localEps map[string]struct{}
} }
func (c *Controller) watchSvcRecord(ep *Endpoint) { func (c *Controller) watchSvcRecord(ep *Endpoint) {
@ -212,9 +212,9 @@ func (c *Controller) processEndpointCreate(ep *Endpoint) {
c.mu.Lock() c.mu.Lock()
_, ok := c.nmap[networkID] _, ok := c.nmap[networkID]
if !ok { if !ok {
c.nmap[networkID] = &netWatch{localEps: make(map[string]*Endpoint)} c.nmap[networkID] = &netWatch{localEps: make(map[string]struct{})}
} }
c.nmap[networkID].localEps[endpointID] = ep c.nmap[networkID].localEps[endpointID] = struct{}{}
c.mu.Unlock() c.mu.Unlock()
} }