Преглед на файлове

Merge pull request #46548 from thaJeztah/libnetwork_inline_populateSpecial

libnetwork: inline populateSpecial NetworkWalker
Sebastiaan van Stijn преди 1 година
родител
ревизия
b1855bb4af
променени са 2 файла, в които са добавени 8 реда и са изтрити 10 реда
  1. 8 1
      libnetwork/controller.go
  2. 0 9
      libnetwork/store.go

+ 8 - 1
libnetwork/controller.go

@@ -140,7 +140,14 @@ func New(cfgOptions ...config.Option) (*Controller, error) {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	c.WalkNetworks(populateSpecial)
+	c.WalkNetworks(func(nw *Network) bool {
+		if n := nw; n.hasSpecialDriver() && !n.ConfigOnly() {
+			if err := n.getController().addNetwork(n); err != nil {
+				log.G(context.TODO()).Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
+			}
+		}
+		return false
+	})
 
 
 	// Reserve pools first before doing cleanup. Otherwise the
 	// Reserve pools first before doing cleanup. Otherwise the
 	// cleanups of endpoint/network and sandbox below will
 	// cleanups of endpoint/network and sandbox below will

+ 0 - 9
libnetwork/store.go

@@ -287,12 +287,3 @@ func (c *Controller) networkCleanup() {
 		}
 		}
 	}
 	}
 }
 }
-
-var populateSpecial NetworkWalker = func(nw *Network) bool {
-	if n := nw; n.hasSpecialDriver() && !n.ConfigOnly() {
-		if err := n.getController().addNetwork(n); err != nil {
-			log.G(context.TODO()).Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
-		}
-	}
-	return false
-}