Переглянути джерело

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>
Cory Snider 1 рік тому
батько
коміт
29da565133
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      libnetwork/store.go

+ 3 - 3
libnetwork/store.go

@@ -185,7 +185,7 @@ retry:
 }
 
 type netWatch struct {
-	localEps map[string]*Endpoint
+	localEps map[string]struct{}
 }
 
 func (c *Controller) watchSvcRecord(ep *Endpoint) {
@@ -212,9 +212,9 @@ func (c *Controller) processEndpointCreate(ep *Endpoint) {
 	c.mu.Lock()
 	_, ok := c.nmap[networkID]
 	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()
 }