From f9835aff3d6eb6e56655a476b6f4d976bb41f42e Mon Sep 17 00:00:00 2001 From: Gian Biondi Date: Tue, 28 Apr 2015 18:10:35 -0400 Subject: [PATCH] Implements GoAway frame handler --- transport/http2_server.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/transport/http2_server.go b/transport/http2_server.go index 3dfc49e0..a19581a8 100644 --- a/transport/http2_server.go +++ b/transport/http2_server.go @@ -281,6 +281,8 @@ func (t *http2Server) HandleStreams(handle func(*Stream)) { t.handlePing(frame) case *http2.WindowUpdateFrame: t.handleWindowUpdate(frame) + case *http2.GoAwayFrame: + t.handleGoAway(frame) default: 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 { first := true endHeaders := false