Просмотр исходного кода

Fix an issue in overlay network peer EP list maintenance

Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Santhosh Manohar 9 лет назад
Родитель
Сommit
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
 			var addEp []*endpoint
 
 
 			delEpMap := make(map[string]*endpoint)
 			delEpMap := make(map[string]*endpoint)
+			renameEpMap := make(map[string]bool)
 			for k, v := range nw.remoteEps {
 			for k, v := range nw.remoteEps {
 				delEpMap[k] = v
 				delEpMap[k] = v
 			}
 			}
@@ -285,10 +286,20 @@ func (c *controller) networkWatchLoop(nw *netWatch, ep *endpoint, ecCh <-chan da
 						delete(delEpMap, lEp.ID())
 						delete(delEpMap, lEp.ID())
 						continue
 						continue
 					}
 					}
+					renameEpMap[lEp.ID()] = true
 				}
 				}
 				nw.remoteEps[lEp.ID()] = lEp
 				nw.remoteEps[lEp.ID()] = lEp
 				addEp = append(addEp, 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()
 			c.Unlock()
 
 
 			for _, lEp := range delEpMap {
 			for _, lEp := range delEpMap {