Browse Source

Merge pull request #1395 from LK4D4/fix_svc_race

network: fix race in read access to map
Santhosh Manohar 9 years ago
parent
commit
7a7112b794
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libnetwork/network.go

+ 1 - 1
libnetwork/network.go

@@ -1110,8 +1110,8 @@ func (n *network) getSvcRecords(ep *endpoint) []etchosts.Record {
 	epName := ep.Name()
 
 	n.ctrlr.Lock()
+	defer n.ctrlr.Unlock()
 	sr, _ := n.ctrlr.svcRecords[n.id]
-	n.ctrlr.Unlock()
 
 	for h, ip := range sr.svcMap {
 		if strings.Split(h, ".")[0] == epName {