Merge pull request #535 from iamqizhao/master
Close ServerTransport instead of the raw connection
diff --git a/server.go b/server.go
index 1c42b6e..d71c094 100644
--- a/server.go
+++ b/server.go
@@ -279,7 +279,7 @@
return
}
if !s.addConn(st) {
- c.Close()
+ st.Close()
return
}
s.serveStreams(st)
diff --git a/test/end2end_test.go b/test/end2end_test.go
index f1c7b42..ff04c27 100644
--- a/test/end2end_test.go
+++ b/test/end2end_test.go
@@ -1354,8 +1354,6 @@
return
}
-var failOnLeaks = flag.Bool("fail_on_leaks", false, "Fail tests if goroutines leak.")
-
// leakCheck snapshots the currently-running goroutines and returns a
// function to be run at the end of tests to see whether any
// goroutines leaked.
@@ -1364,10 +1362,6 @@
for _, g := range interestingGoroutines() {
orig[g] = true
}
- leakf := t.Logf
- if *failOnLeaks {
- leakf = t.Errorf
- }
return func() {
// Loop, waiting for goroutines to shut down.
// Wait up to 5 seconds, but finish as quickly as possible.
@@ -1387,7 +1381,7 @@
continue
}
for _, g := range leaked {
- leakf("Leaked goroutine: %v", g)
+ t.Errorf("Leaked goroutine: %v", g)
}
return
}