From 6fa6f0b13052d7c0f1848e9acbbf95d2869b8790 Mon Sep 17 00:00:00 2001 From: Gian Biondi Date: Thu, 30 Apr 2015 12:18:09 -0400 Subject: [PATCH] Moves return on goaway to ensure header decoding --- transport/http2_server.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) 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 {