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 { 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
// New core now allows users to omit bandwidth values and use built-in congestion control
return nil
}
var err error var err error
hyConfig.BandwidthConfig.MaxTx, err = convBandwidth(c.Bandwidth.Up) if c.Bandwidth.Up != "" {
if err != nil { hyConfig.BandwidthConfig.MaxTx, err = convBandwidth(c.Bandwidth.Up)
return configError{Field: "bandwidth.up", Err: err} if err != nil {
return configError{Field: "bandwidth.up", Err: err}
}
} }
hyConfig.BandwidthConfig.MaxRx, err = convBandwidth(c.Bandwidth.Down) if c.Bandwidth.Down != "" {
if err != nil { hyConfig.BandwidthConfig.MaxRx, err = convBandwidth(c.Bandwidth.Down)
return configError{Field: "bandwidth.down", Err: err} if err != nil {
return configError{Field: "bandwidth.down", Err: err}
}
} }
return nil return nil
} }

View File

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