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