Skip to content

Commit

Permalink
refactor populate config to not use provided config
Browse files Browse the repository at this point in the history
  • Loading branch information
joliveirinha committed Aug 16, 2022
1 parent b8940e5 commit 0bc50d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions config.go
Expand Up @@ -68,8 +68,9 @@ func populateConfig(config *Config, defaultConnIDLen int) *Config {
if len(versions) == 0 {
versions = protocol.SupportedVersions
}
conIDLen := config.ConnectionIDLength
if config.ConnectionIDLength == 0 {
config.ConnectionIDLength = defaultConnIDLen
conIDLen = defaultConnIDLen
}
handshakeIdleTimeout := protocol.DefaultHandshakeIdleTimeout
if config.HandshakeIdleTimeout != 0 {
Expand Down Expand Up @@ -109,7 +110,7 @@ func populateConfig(config *Config, defaultConnIDLen int) *Config {
}
connIDGenerator := config.ConnectionIDGenerator
if connIDGenerator == nil {
connIDGenerator = &protocol.DefaultConnectionIDGenerator{ConnLen: config.ConnectionIDLength}
connIDGenerator = &protocol.DefaultConnectionIDGenerator{ConnLen: conIDLen}
}

return &Config{
Expand All @@ -127,7 +128,7 @@ func populateConfig(config *Config, defaultConnIDLen int) *Config {
AllowConnectionWindowIncrease: config.AllowConnectionWindowIncrease,
MaxIncomingStreams: maxIncomingStreams,
MaxIncomingUniStreams: maxIncomingUniStreams,
ConnectionIDLength: config.ConnectionIDLength,
ConnectionIDLength: conIDLen,
ConnectionIDGenerator: connIDGenerator,
StatelessResetKey: config.StatelessResetKey,
TokenStore: config.TokenStore,
Expand Down

0 comments on commit 0bc50d9

Please sign in to comment.