diff --git a/transport/http2_server.go b/transport/http2_server.go index 9a4f0dfa..07913377 100644 --- a/transport/http2_server.go +++ b/transport/http2_server.go @@ -146,10 +146,6 @@ func (t *http2Server) operateHeaders(hDec *hpackDecoder, s *Stream, frame header hDec.state = decodeState{} } }() - if t.goaway { - //Stop creating streams on this transport - return nil - } endHeaders, err := hDec.decodeServerHTTP2Headers(frame) if s == nil { // s has been closed. @@ -169,6 +165,10 @@ func (t *http2Server) operateHeaders(hDec *hpackDecoder, s *Stream, frame header if !endHeaders { return s } + if t.goaway { + //Stop creating streams on this transport + return nil + } t.mu.Lock() if t.state != reachable { t.mu.Unlock() @@ -413,13 +413,6 @@ func (t *http2Server) handleGoAway(f *http2.GoAwayFrame) { t.mu.Lock() t.goaway = true t.mu.Unlock() - for id, _ := range t.activeStreams { - if id > f.LastStreamID { - if s, ok := t.activeStreams[f.LastStreamID]; ok { - t.closeStream(s) - } - } - } } func (t *http2Server) writeHeaders(s *Stream, b *bytes.Buffer, endStream bool) error {