Merge pull request #18524 from thockin/kube-proxy-close

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2015-12-17 01:33:12 -08:00
commit 5b6a7c6012

View File

@ -153,8 +153,6 @@ func proxyTCP(in, out *net.TCPConn) {
go copyBytes("from backend", in, out, &wg)
go copyBytes("to backend", out, in, &wg)
wg.Wait()
in.Close()
out.Close()
}
func copyBytes(direction string, dest, src *net.TCPConn, wg *sync.WaitGroup) {
@ -162,11 +160,13 @@ func copyBytes(direction string, dest, src *net.TCPConn, wg *sync.WaitGroup) {
glog.V(4).Infof("Copying %s: %s -> %s", direction, src.RemoteAddr(), dest.RemoteAddr())
n, err := io.Copy(dest, src)
if err != nil {
glog.Errorf("I/O error: %v", err)
if !isClosedError(err) {
glog.Errorf("I/O error: %v", err)
}
}
glog.V(4).Infof("Copied %d bytes %s: %s -> %s", n, direction, src.RemoteAddr(), dest.RemoteAddr())
dest.CloseWrite()
src.CloseRead()
dest.Close()
src.Close()
}
// udpProxySocket implements proxySocket. Close() is implemented by net.UDPConn. When Close() is called,