After sending second goaway close conn if idle. (#1736)
This commit is contained in:
@ -1069,6 +1069,9 @@ func (t *http2Server) itemHandler(i item) error {
|
|||||||
if !i.headsUp {
|
if !i.headsUp {
|
||||||
// Stop accepting more streams now.
|
// Stop accepting more streams now.
|
||||||
t.state = draining
|
t.state = draining
|
||||||
|
if len(t.activeStreams) == 0 {
|
||||||
|
i.closeConn = true
|
||||||
|
}
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
if err := t.framer.fr.WriteGoAway(sid, i.code, i.debugData); err != nil {
|
if err := t.framer.fr.WriteGoAway(sid, i.code, i.debugData); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1076,8 +1079,7 @@ func (t *http2Server) itemHandler(i item) error {
|
|||||||
if i.closeConn {
|
if i.closeConn {
|
||||||
// Abruptly close the connection following the GoAway (via
|
// Abruptly close the connection following the GoAway (via
|
||||||
// loopywriter). But flush out what's inside the buffer first.
|
// loopywriter). But flush out what's inside the buffer first.
|
||||||
t.framer.writer.Flush()
|
t.controlBuf.put(&flushIO{closeTr: true})
|
||||||
return fmt.Errorf("transport: Connection closing")
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1111,7 +1113,7 @@ func (t *http2Server) itemHandler(i item) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if i.closeTr {
|
if i.closeTr {
|
||||||
t.Close()
|
return ErrConnClosing
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
case *ping:
|
case *ping:
|
||||||
|
Reference in New Issue
Block a user