Forráskód Böngészése

Merge pull request #472 from cloudflare/remap-lock

lock port mapper when reapplying iptables rules
Jana Radhakrishnan 9 éve
szülő
commit
a6f6e2f2b9
1 módosított fájl, 2 hozzáadás és 0 törlés
  1. 2 0
      libnetwork/portmapper/mapper.go

+ 2 - 0
libnetwork/portmapper/mapper.go

@@ -188,6 +188,8 @@ func (pm *PortMapper) Unmap(host net.Addr) error {
 
 
 //ReMapAll will re-apply all port mappings
 //ReMapAll will re-apply all port mappings
 func (pm *PortMapper) ReMapAll() {
 func (pm *PortMapper) ReMapAll() {
+	pm.lock.Lock()
+	defer pm.lock.Unlock()
 	logrus.Debugln("Re-applying all port mappings.")
 	logrus.Debugln("Re-applying all port mappings.")
 	for _, data := range pm.currentMappings {
 	for _, data := range pm.currentMappings {
 		containerIP, containerPort := getIPAndPort(data.container)
 		containerIP, containerPort := getIPAndPort(data.container)