When sending a non heads-up goaway close the connection if there are no active streams. (#1474)

This commit is contained in:
mmukhi
2017-08-25 14:57:41 -07:00
committed by dfawley
parent fa59b779e8
commit 39596153a9

View File

@ -1089,9 +1089,10 @@ func (t *http2Server) controller() {
if !i.headsUp {
// Stop accepting more streams now.
t.state = draining
activeStreams := len(t.activeStreams)
t.mu.Unlock()
t.framer.writeGoAway(true, sid, i.code, i.debugData)
if i.closeConn {
if i.closeConn || activeStreams == 0 {
// Abruptly close the connection following the GoAway.
t.Close()
}