proxy: we don't need to explicitly unexposePort any more

The port will be automatically removed when the fd/fid is closed by
a process exit/crash, or by a hypervisor crash.

Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
David Scott 2016-04-14 17:43:22 +01:00
parent e4f405be26
commit b0c4fdae37

View File

@ -20,13 +20,11 @@ func main() {
} }
p, err := libproxy.NewProxy(host, container) p, err := libproxy.NewProxy(host, container)
if err != nil { if err != nil {
unexposePort(host)
sendError(err) sendError(err)
} }
go handleStopSignals(p) go handleStopSignals(p)
sendOK() sendOK()
p.Run() p.Run()
unexposePort(host)
os.Exit(0) os.Exit(0)
} }
@ -71,12 +69,3 @@ func exposePort(host net.Addr, port int) error {
return nil return nil
} }
func unexposePort(host net.Addr) {
name := host.String()
log.Printf("unexposePort %s\n", name)
err := os.Remove("/port/" + name)
if err != nil {
log.Printf("Failed to remove /port/%s: %#v\n", name, err)
}
}