Should not defer conn.Close when leaking the connection

pull/6/head
Bowei Du 2016-10-31 22:10:35 -07:00
parent a06fc6ab7a
commit 938430b1eb
1 changed files with 5 additions and 2 deletions

View File

@ -36,7 +36,8 @@ import (
"k8s.io/kubernetes/test/images/net/common"
)
// leakedConnection is a
// leakedConnection is a global variable that should leak the active
// connection assigned here.
var leakedConnection *net.TCPConn
// Server JSON options.
@ -156,7 +157,9 @@ func (client *closeWaitClient) Run(logger *log.Logger, rawOptions interface{}) e
if err != nil {
return err
}
if !client.options.LeakConnection {
defer conn.Close()
}
logger.Printf("Connected to server")