Moves return on goaway to ensure header decoding

This commit is contained in:
Gian Biondi 2015-04-30 12:18:09 -04:00
Родитель dbe74dd6c5
Коммит 6fa6f0b130
1 изменённых файлов: 4 добавлений и 11 удалений

Просмотреть файл

@ -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 {