From 84b1ef9bd57f674fea507a5dbe42b7a175ca5a15 Mon Sep 17 00:00:00 2001 From: Santhosh Manohar Date: Sat, 24 Oct 2015 07:10:03 -0700 Subject: [PATCH] Fix an issue in overlay network peer EP list maintenance Signed-off-by: Santhosh Manohar --- libnetwork/store.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libnetwork/store.go b/libnetwork/store.go index 299e83ad6d..1ea2f7ae89 100644 --- a/libnetwork/store.go +++ b/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 {