Commit 0c96df33 authored by Tom Bergan's avatar Tom Bergan Committed by Brad Fitzpatrick

http2: fix minor stream accounting bug

Update golang/go#18083

Change-Id: I2600f8a7a0d3a630003c010496a7fceca1b9f660
Reviewed-on: https://go-review.googlesource.com/33974Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
parent 4a1c855a
......@@ -423,6 +423,11 @@ func (sc *serverConn) maxHeaderListSize() uint32 {
return uint32(n + typicalHeaders*perFieldOverhead)
}
func (sc *serverConn) curOpenStreams() uint32 {
sc.serveG.check()
return sc.curClientStreams + sc.curPushedStreams
}
// stream represents a stream. This is the minimal metadata needed by
// the serve goroutine. Most of the actual stream state is owned by
// the http.Handler's goroutine in the responseWriter. Because the
......@@ -753,7 +758,7 @@ func (sc *serverConn) serve() {
fn(loopNum)
}
if sc.inGoAway && sc.curClientStreams == 0 && !sc.needToSendGoAway && !sc.writingFrame {
if sc.inGoAway && sc.curOpenStreams() == 0 && !sc.needToSendGoAway && !sc.writingFrame {
return
}
}
......@@ -1681,7 +1686,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
} else {
sc.curClientStreams++
}
if sc.curClientStreams+sc.curPushedStreams == 1 {
if sc.curOpenStreams() == 1 {
sc.setConnState(http.StateActive)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment