proxy: calling Close() on the Accept()ing fd won't cause it to return

This seems to be a difference between the AF_VSOCK and AF_INET
implementations. We work around it by exiting the proxy process
immediately, which will clean up resources anyway.

Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
David Scott 2016-04-15 13:02:10 +01:00
parent 586d9c0598
commit a48307b5e7
2 changed files with 4 additions and 1 deletions

View File

@ -67,6 +67,8 @@ func handleStopSignals(p libproxy.Proxy) {
signal.Notify(s, os.Interrupt, syscall.SIGTERM, syscall.SIGSTOP)
for range s {
p.Close()
os.Exit(0)
// The vsock proxy cannot be shutdown the same way as the TCP one:
//p.Close()
}
}

View File

@ -81,6 +81,7 @@ func (v *vsockListener) Accept() (net.Conn, error) {
}
func (v *vsockListener) Close() error {
// Note this won't cause the Accept to unblock.
return syscall.Close(v.accept_fd)
}