chore: some code fixes

This commit is contained in:
Toby 2023-08-04 17:48:07 -07:00
parent 45c3fc54bd
commit 3b4af8035b
3 changed files with 13 additions and 12 deletions

View file

@ -184,18 +184,19 @@ func (c *clientConfig) fillQUICConfig(hyConfig *client.Config) error {
}
func (c *clientConfig) fillBandwidthConfig(hyConfig *client.Config) error {
if c.Bandwidth.Up == "" || c.Bandwidth.Down == "" {
// New core now allows users to omit bandwidth values and use built-in congestion control
return nil
}
// New core now allows users to omit bandwidth values and use built-in congestion control
var err error
hyConfig.BandwidthConfig.MaxTx, err = convBandwidth(c.Bandwidth.Up)
if err != nil {
return configError{Field: "bandwidth.up", Err: err}
if c.Bandwidth.Up != "" {
hyConfig.BandwidthConfig.MaxTx, err = convBandwidth(c.Bandwidth.Up)
if err != nil {
return configError{Field: "bandwidth.up", Err: err}
}
}
hyConfig.BandwidthConfig.MaxRx, err = convBandwidth(c.Bandwidth.Down)
if err != nil {
return configError{Field: "bandwidth.down", Err: err}
if c.Bandwidth.Down != "" {
hyConfig.BandwidthConfig.MaxRx, err = convBandwidth(c.Bandwidth.Down)
if err != nil {
return configError{Field: "bandwidth.down", Err: err}
}
}
return nil
}

View file

@ -132,7 +132,7 @@ func (c *clientImpl) connect() error {
conn.SetCongestionControl(bbr.NewBBRSender(
bbr.DefaultClock{},
bbr.GetInitialPacketSize(conn.RemoteAddr()),
32*common.InitMaxDatagramSize,
bbr.InitialCongestionWindow*common.InitMaxDatagramSize,
bbr.DefaultBBRMaxCongestionWindow*common.InitMaxDatagramSize,
))
}

View file

@ -135,7 +135,7 @@ func (h *h3sHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.conn.SetCongestionControl(bbr.NewBBRSender(
bbr.DefaultClock{},
bbr.GetInitialPacketSize(h.conn.RemoteAddr()),
32*common.InitMaxDatagramSize,
bbr.InitialCongestionWindow*common.InitMaxDatagramSize,
bbr.DefaultBBRMaxCongestionWindow*common.InitMaxDatagramSize,
))
}