mirror of
https://github.com/soheilhy/cmux.git
synced 2025-01-19 03:06:07 +08:00
feat: avoid writing multiple settings
This commit is contained in:
parent
677b4b20e7
commit
51cff2c8bc
10
matchers.go
10
matchers.go
@ -266,10 +266,12 @@ func matchHTTP2Field(w io.Writer, r io.Reader, name string, matches func(string)
|
||||
waitAcks--
|
||||
break
|
||||
}
|
||||
if err := framer.WriteSettings(); err != nil {
|
||||
return false
|
||||
if waitAcks <= 0 {
|
||||
if err := framer.WriteSettings(); err != nil {
|
||||
return false
|
||||
}
|
||||
waitAcks++
|
||||
}
|
||||
waitAcks++
|
||||
case *http2.ContinuationFrame:
|
||||
if _, err := hdec.Write(f.HeaderBlockFragment()); err != nil {
|
||||
return false
|
||||
@ -282,7 +284,7 @@ func matchHTTP2Field(w io.Writer, r io.Reader, name string, matches func(string)
|
||||
done = done || f.FrameHeader.Flags&http2.FlagHeadersEndHeaders != 0
|
||||
}
|
||||
|
||||
if done && waitAcks == 0 {
|
||||
if done && waitAcks <= 0 {
|
||||
return matched
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user