diff --git a/pkg/proxy/proxier.go b/pkg/proxy/proxier.go index 698eb51ed75..f34ca3eb572 100644 --- a/pkg/proxy/proxier.go +++ b/pkg/proxy/proxier.go @@ -125,6 +125,17 @@ func proxyTCP(in, out *net.TCPConn) { out.Close() } +func copyBytes(in, out *net.TCPConn, wg *sync.WaitGroup) { + defer wg.Done() + glog.Infof("Copying from %v <-> %v <-> %v <-> %v", + in.RemoteAddr(), in.LocalAddr(), out.LocalAddr(), out.RemoteAddr()) + if _, err := io.Copy(in, out); err != nil { + glog.Errorf("I/O error: %v", err) + } + in.CloseRead() + out.CloseWrite() +} + // udpProxySocket implements proxySocket. Close() is implemented by net.UDPConn. When Close() is called, // no new connections are allowed and existing connections are broken. // TODO: We could lame-duck this ourselves, if it becomes important. @@ -306,17 +317,6 @@ func NewProxier(loadBalancer LoadBalancer, address string) *Proxier { } } -func copyBytes(in, out *net.TCPConn, wg *sync.WaitGroup) { - defer wg.Done() - glog.Infof("Copying from %v <-> %v <-> %v <-> %v", - in.RemoteAddr(), in.LocalAddr(), out.LocalAddr(), out.RemoteAddr()) - if _, err := io.Copy(in, out); err != nil { - glog.Errorf("I/O error: %v", err) - } - in.CloseRead() - out.CloseWrite() -} - // StopProxy stops the proxy for the named service. func (proxier *Proxier) StopProxy(service string) error { info, found := proxier.getServiceInfo(service)