Implements GoAway frame handler
This commit is contained in:
Родитель
97f42dd262
Коммит
f9835aff3d
|
@ -281,6 +281,8 @@ func (t *http2Server) HandleStreams(handle func(*Stream)) {
|
||||||
t.handlePing(frame)
|
t.handlePing(frame)
|
||||||
case *http2.WindowUpdateFrame:
|
case *http2.WindowUpdateFrame:
|
||||||
t.handleWindowUpdate(frame)
|
t.handleWindowUpdate(frame)
|
||||||
|
case *http2.GoAwayFrame:
|
||||||
|
t.handleGoAway(frame)
|
||||||
default:
|
default:
|
||||||
log.Printf("transport: http2Server.HandleStreams found unhandled frame type %v.", frame)
|
log.Printf("transport: http2Server.HandleStreams found unhandled frame type %v.", frame)
|
||||||
}
|
}
|
||||||
|
@ -400,6 +402,16 @@ func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *http2Server) handleGoAway(f *http2.GoAwayFrame) {
|
||||||
|
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 {
|
func (t *http2Server) writeHeaders(s *Stream, b *bytes.Buffer, endStream bool) error {
|
||||||
first := true
|
first := true
|
||||||
endHeaders := false
|
endHeaders := false
|
||||||
|
|
Загрузка…
Ссылка в новой задаче