Selaa lähdekoodia

Merge pull request #1346 from aboch/lk

Lock in isAgent() and inMaster()
Madhu Venugopal 9 vuotta sitten
vanhempi
commit
d6fefd1ad8
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      libnetwork/controller.go

+ 4 - 0
libnetwork/controller.go

@@ -526,6 +526,8 @@ func (c *controller) Config() config.Config {
 }
 }
 
 
 func (c *controller) isManager() bool {
 func (c *controller) isManager() bool {
+	c.Lock()
+	defer c.Unlock()
 	if c.cfg == nil || c.cfg.Daemon.ClusterProvider == nil {
 	if c.cfg == nil || c.cfg.Daemon.ClusterProvider == nil {
 		return false
 		return false
 	}
 	}
@@ -533,6 +535,8 @@ func (c *controller) isManager() bool {
 }
 }
 
 
 func (c *controller) isAgent() bool {
 func (c *controller) isAgent() bool {
+	c.Lock()
+	defer c.Unlock()
 	if c.cfg == nil || c.cfg.Daemon.ClusterProvider == nil {
 	if c.cfg == nil || c.cfg.Daemon.ClusterProvider == nil {
 		return false
 		return false
 	}
 	}