Skip to content

Commit

Permalink
XHTTP XMUX: cMaxLifetimeMs -> hMaxReusableSecs, Refactor default values
Browse files Browse the repository at this point in the history
"xmux": {
    "maxConcurrency": "16-32",
    "maxConnections": 0,
    "cMaxReuseTimes": 0,
    "hMaxRequestTimes": "600-900",
    "hMaxReusableSecs": "1800-3000",
    "hKeepAlivePeriod": 0
}
  • Loading branch information
RPRX authored Dec 31, 2024
1 parent 93f72db commit 7306316
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 112 deletions.
10 changes: 5 additions & 5 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ type XmuxConfig struct {
MaxConcurrency Int32Range `json:"maxConcurrency"`
MaxConnections Int32Range `json:"maxConnections"`
CMaxReuseTimes Int32Range `json:"cMaxReuseTimes"`
CMaxLifetimeMs Int32Range `json:"cMaxLifetimeMs"`
HMaxRequestTimes Int32Range `json:"hMaxRequestTimes"`
HMaxReusableSecs Int32Range `json:"hMaxReusableSecs"`
HKeepAlivePeriod int64 `json:"hKeepAlivePeriod"`
}

Expand Down Expand Up @@ -287,10 +287,10 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
if c.Xmux == (XmuxConfig{}) {
c.Xmux.MaxConcurrency.From = 16
c.Xmux.MaxConcurrency.To = 32
c.Xmux.CMaxReuseTimes.From = 256
c.Xmux.CMaxReuseTimes.To = 512
c.Xmux.HMaxRequestTimes.From = 800
c.Xmux.HMaxRequestTimes.From = 600
c.Xmux.HMaxRequestTimes.To = 900
c.Xmux.HMaxReusableSecs.From = 1800
c.Xmux.HMaxReusableSecs.To = 3000
}

config := &splithttp.Config{
Expand All @@ -308,8 +308,8 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
MaxConcurrency: newRangeConfig(c.Xmux.MaxConcurrency),
MaxConnections: newRangeConfig(c.Xmux.MaxConnections),
CMaxReuseTimes: newRangeConfig(c.Xmux.CMaxReuseTimes),
CMaxLifetimeMs: newRangeConfig(c.Xmux.CMaxLifetimeMs),
HMaxRequestTimes: newRangeConfig(c.Xmux.HMaxRequestTimes),
HMaxReusableSecs: newRangeConfig(c.Xmux.HMaxReusableSecs),
HKeepAlivePeriod: c.Xmux.HKeepAlivePeriod,
},
}
Expand Down
19 changes: 10 additions & 9 deletions transport/internet/splithttp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,36 +105,37 @@ func (c *Config) GetNormalizedXPaddingBytes() RangeConfig {
return *c.XPaddingBytes
}

func (m *XmuxConfig) GetNormalizedCMaxRequestTimes() RangeConfig {
if m.HMaxRequestTimes == nil {
func (m *XmuxConfig) GetNormalizedHMaxReusableSecs() RangeConfig {
if m.HMaxReusableSecs == nil {
return RangeConfig{
From: 0,
To: 0,
}
}

return *m.HMaxRequestTimes
return *m.HMaxReusableSecs
}

func (m *XmuxConfig) GetNormalizedCMaxReuseTimes() RangeConfig {
if m.CMaxReuseTimes == nil {
func (m *XmuxConfig) GetNormalizedCMaxRequestTimes() RangeConfig {
if m.HMaxRequestTimes == nil {
return RangeConfig{
From: 0,
To: 0,
}
}

return *m.CMaxReuseTimes
return *m.HMaxRequestTimes
}

func (m *XmuxConfig) GetNormalizedCMaxLifetimeMs() RangeConfig {
if m.CMaxLifetimeMs == nil {
func (m *XmuxConfig) GetNormalizedCMaxReuseTimes() RangeConfig {
if m.CMaxReuseTimes == nil {
return RangeConfig{
From: 0,
To: 0,
}
}
return *m.CMaxLifetimeMs

return *m.CMaxReuseTimes
}

func (m *XmuxConfig) GetNormalizedMaxConnections() RangeConfig {
Expand Down
Loading

0 comments on commit 7306316

Please sign in to comment.