Преглед на файлове

Fix an issue in overlay network peer EP list maintenance

Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Santhosh Manohar преди 9 години
родител
ревизия
84b1ef9bd5
променени са 1 файла, в които са добавени 11 реда и са изтрити 0 реда
  1. 11 0
      libnetwork/store.go

+ 11 - 0
libnetwork/store.go

@@ -265,6 +265,7 @@ func (c *controller) networkWatchLoop(nw *netWatch, ep *endpoint, ecCh <-chan da
 			var addEp []*endpoint
 
 			delEpMap := make(map[string]*endpoint)
+			renameEpMap := make(map[string]bool)
 			for k, v := range nw.remoteEps {
 				delEpMap[k] = v
 			}
@@ -285,10 +286,20 @@ func (c *controller) networkWatchLoop(nw *netWatch, ep *endpoint, ecCh <-chan da
 						delete(delEpMap, lEp.ID())
 						continue
 					}
+					renameEpMap[lEp.ID()] = true
 				}
 				nw.remoteEps[lEp.ID()] = lEp
 				addEp = append(addEp, lEp)
 			}
+
+			// EPs whose name are to be deleted from the svc records
+			// should also be removed from nw's remote EP list, except
+			// the ones that are getting renamed.
+			for _, lEp := range delEpMap {
+				if !renameEpMap[lEp.ID()] {
+					delete(nw.remoteEps, lEp.ID())
+				}
+			}
 			c.Unlock()
 
 			for _, lEp := range delEpMap {