bug fix
This commit is contained in:
@ -752,21 +752,29 @@ func (t *http2Client) handlePing(f *http2.PingFrame) {
|
|||||||
|
|
||||||
func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) {
|
func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
|
id := t.goAwayID
|
||||||
if t.state == reachable || t.state == draining {
|
if t.state == reachable || t.state == draining {
|
||||||
if f.LastStreamID > 0 && (f.LastStreamID%2 != 1 || t.goAwayID < f.LastStreamID) {
|
if f.LastStreamID > 0 && f.LastStreamID%2 != 1 {
|
||||||
id := t.goAwayID
|
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
t.notifyError(ConnectionErrorf("received illegal http2 GOAWAY frame: previously recv GOAWAY frame with LastStramID %d, currently recv %d", id, f.LastStreamID))
|
t.notifyError(ConnectionErrorf("received illegal http2 GOAWAY frame: stream ID %d is even", id))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.prevGoAwayID = t.goAwayID
|
|
||||||
t.goAwayID = f.LastStreamID
|
|
||||||
select {
|
select {
|
||||||
case <-t.goAway:
|
case <-t.goAway:
|
||||||
// t.goAway has been closed (i.e.,multiple GoAways).
|
// t.goAway has been closed (i.e.,multiple GoAways).
|
||||||
|
if id < f.LastStreamID {
|
||||||
|
t.mu.Unlock()
|
||||||
|
t.notifyError(ConnectionErrorf("received illegal http2 GOAWAY frame: previously recv GOAWAY frame with LastStramID %d, currently recv %d", id, f.LastStreamID))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.prevGoAwayID = id
|
||||||
|
t.goAwayID = f.LastStreamID
|
||||||
|
t.mu.Unlock()
|
||||||
|
return
|
||||||
default:
|
default:
|
||||||
close(t.goAway)
|
|
||||||
}
|
}
|
||||||
|
t.goAwayID = f.LastStreamID
|
||||||
|
close(t.goAway)
|
||||||
}
|
}
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user