Make sure all goroutines have ended before restoring global vars. (#1732)

This commit is contained in:
mmukhi
2017-12-14 13:23:05 -08:00
committed by GitHub
parent 4742c425a7
commit b8cf13ea06

View File

@ -169,11 +169,12 @@ func TestDialWaitsForServerSettings(t *testing.T) {
} }
func TestCloseConnectionWhenServerPrefaceNotReceived(t *testing.T) { func TestCloseConnectionWhenServerPrefaceNotReceived(t *testing.T) {
defer leakcheck.Check(t)
mctBkp := minConnectTimeout mctBkp := minConnectTimeout
// Call this only after transportMonitor goroutine has ended.
defer func() { defer func() {
minConnectTimeout = mctBkp minConnectTimeout = mctBkp
}() }()
defer leakcheck.Check(t)
minConnectTimeout = time.Millisecond * 500 minConnectTimeout = time.Millisecond * 500
server, err := net.Listen("tcp", "localhost:0") server, err := net.Listen("tcp", "localhost:0")
if err != nil { if err != nil {