From 1bd7276acaf3ccfbc2eefe98ed83578eaf77436f Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 15 Jul 2014 20:55:04 +0900 Subject: [PATCH] Correct the style of nested conditionals --- pkg/proxy/proxier.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/proxy/proxier.go b/pkg/proxy/proxier.go index 602b7c69b87..a7822e56a29 100644 --- a/pkg/proxy/proxier.go +++ b/pkg/proxy/proxier.go @@ -127,14 +127,15 @@ func (proxier Proxier) OnUpdate(services []api.Service) { glog.Infof("Received update notice: %+v", services) for _, service := range services { port, exists := proxier.serviceMap[service.ID] - if !exists || port != service.Port { - glog.Infof("Adding a new service %s on port %d", service.ID, service.Port) - err := proxier.addService(service.ID, service.Port) - if err == nil { - proxier.serviceMap[service.ID] = service.Port - } else { - glog.Infof("Failed to start listening for %s on %d", service.ID, service.Port) - } + if exists && port == service.Port { + continue } + glog.Infof("Adding a new service %s on port %d", service.ID, service.Port) + err := proxier.addService(service.ID, service.Port) + if err != nil { + glog.Infof("Failed to start listening for %s on %d", service.ID, service.Port) + continue + } + proxier.serviceMap[service.ID] = service.Port } }