Update port info on network connect/disconnect

Signed-off-by: Alessandro Boch <aboch@docker.com>
Upstream-commit: f198dfd856ca6125ef50b11d9d698550d66c9d4e
Component: engine
This commit is contained in:
Alessandro Boch
2016-05-25 13:47:38 -07:00
parent 5a1641d4f8
commit 611bbe573a
3 changed files with 54 additions and 2 deletions

View File

@ -660,7 +660,8 @@ func getEndpointPortMapInfo(ep libnetwork.Endpoint) (nat.PortMap, error) {
return pm, nil
}
func getSandboxPortMapInfo(sb libnetwork.Sandbox) nat.PortMap {
// GetSandboxPortMapInfo retrieves the current port-mapping programmed for the given sandbox
func GetSandboxPortMapInfo(sb libnetwork.Sandbox) nat.PortMap {
pm := nat.PortMap{}
if sb == nil {
return pm
@ -817,7 +818,7 @@ func (container *Container) BuildCreateEndpointOptions(n libnetwork.Network, epC
}
// Port-mapping rules belong to the container & applicable only to non-internal networks
portmaps := getSandboxPortMapInfo(sb)
portmaps := GetSandboxPortMapInfo(sb)
if n.Info().Internal() || len(portmaps) > 0 {
return createOptions, nil
}