Browse code

getAllNetworks unnecessary walks all the networks

- libnetwork controller Networks() already returns
a copy list. Also Networks() correctly skips any
network which ahs already been marked for deletion
while getNetworks implementation bypass this.

Signed-off-by: Alessandro Boch <aboch@docker.com>

Alessandro Boch authored on 2017/02/07 09:37:51
Showing 1 changed files
... ...
@@ -96,15 +96,7 @@ func (daemon *Daemon) GetNetworksByID(partialID string) []libnetwork.Network {
96 96
 
97 97
 // getAllNetworks returns a list containing all networks
98 98
 func (daemon *Daemon) getAllNetworks() []libnetwork.Network {
99
-	c := daemon.netController
100
-	list := []libnetwork.Network{}
101
-	l := func(nw libnetwork.Network) bool {
102
-		list = append(list, nw)
103
-		return false
104
-	}
105
-	c.WalkNetworks(l)
106
-
107
-	return list
99
+	return daemon.netController.Networks()
108 100
 }
109 101
 
110 102
 func isIngressNetwork(name string) bool {