Merge pull request #649 from iamqizhao/fix
Close errorChan even when there is no pending I/O
This commit is contained in:
Коммит
95f4d27b65
|
@ -746,6 +746,24 @@ func testHealthCheckServingStatus(t *testing.T, e env) {
|
|||
|
||||
}
|
||||
|
||||
func TestErrorChanNoIO(t *testing.T) {
|
||||
defer leakCheck(t)()
|
||||
for _, e := range listTestEnv() {
|
||||
testErrorChanNoIO(t, e)
|
||||
}
|
||||
}
|
||||
|
||||
func testErrorChanNoIO(t *testing.T, e env) {
|
||||
te := newTest(t, e)
|
||||
te.startServer()
|
||||
defer te.tearDown()
|
||||
|
||||
tc := testpb.NewTestServiceClient(te.clientConn())
|
||||
if _, err := tc.FullDuplexCall(context.Background()); err != nil {
|
||||
t.Fatalf("%v.FullDuplexCall(_) = _, %v, want <nil>", tc, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyUnaryWithUserAgent(t *testing.T) {
|
||||
defer leakCheck(t)()
|
||||
for _, e := range listTestEnv() {
|
||||
|
|
|
@ -427,6 +427,9 @@ func (t *http2Client) CloseStream(s *Stream, err error) {
|
|||
// accessed any more.
|
||||
func (t *http2Client) Close() (err error) {
|
||||
t.mu.Lock()
|
||||
if t.state == reachable {
|
||||
close(t.errorChan)
|
||||
}
|
||||
if t.state == closing {
|
||||
t.mu.Unlock()
|
||||
return errors.New("transport: Close() was already called")
|
||||
|
|
Загрузка…
Ссылка в новой задаче