In gracefull stop close server transport only after flushing status of the last stream. (#1734)
This commit is contained in:
@ -116,6 +116,7 @@ type goAway struct {
|
|||||||
func (*goAway) item() {}
|
func (*goAway) item() {}
|
||||||
|
|
||||||
type flushIO struct {
|
type flushIO struct {
|
||||||
|
closeTr bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*flushIO) item() {}
|
func (*flushIO) item() {}
|
||||||
|
@ -1107,7 +1107,13 @@ func (t *http2Server) itemHandler(i item) error {
|
|||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
case *flushIO:
|
case *flushIO:
|
||||||
return t.framer.writer.Flush()
|
if err := t.framer.writer.Flush(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if i.closeTr {
|
||||||
|
t.Close()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
case *ping:
|
case *ping:
|
||||||
if !i.ack {
|
if !i.ack {
|
||||||
t.bdpEst.timesnap(i.data)
|
t.bdpEst.timesnap(i.data)
|
||||||
@ -1155,7 +1161,7 @@ func (t *http2Server) closeStream(s *Stream) {
|
|||||||
t.idle = time.Now()
|
t.idle = time.Now()
|
||||||
}
|
}
|
||||||
if t.state == draining && len(t.activeStreams) == 0 {
|
if t.state == draining && len(t.activeStreams) == 0 {
|
||||||
defer t.Close()
|
defer t.controlBuf.put(&flushIO{closeTr: true})
|
||||||
}
|
}
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
// In case stream sending and receiving are invoked in separate
|
// In case stream sending and receiving are invoked in separate
|
||||||
|
Reference in New Issue
Block a user