diff --git a/transport/http2_client.go b/transport/http2_client.go index 51cf1792..036da819 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -418,9 +418,7 @@ func (t *http2Client) CloseStream(s *Stream, err error) { delete(t.activeStreams, s.id) if t.state == draining && len(t.activeStreams) == 0 { // The transport is draining and s is the last live stream on t. - t.mu.Unlock() - t.Close() - return + defer t.Close() } t.mu.Unlock() if updateStreams {