From 354bbb0e2ec710381e29559cf07f9d6d60349cb9 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 13 Mar 2021 11:21:11 +0800 Subject: [PATCH 1/2] rename the Config values for Initial{Stream, Connection}ReceiveWindow --- config.go | 16 ++++++++-------- config_test.go | 8 ++++---- interface.go | 8 ++++---- session.go | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/config.go b/config.go index 886ef0d6..10a4afa2 100644 --- a/config.go +++ b/config.go @@ -71,17 +71,17 @@ func populateConfig(config *Config) *Config { if config.MaxIdleTimeout != 0 { idleTimeout = config.MaxIdleTimeout } - initialStreamFlowControlWindow := config.InitialStreamFlowControlWindow - if initialStreamFlowControlWindow == 0 { - initialStreamFlowControlWindow = protocol.DefaultInitialMaxStreamData + initialStreamReceiveWindow := config.InitialStreamReceiveWindow + if initialStreamReceiveWindow == 0 { + initialStreamReceiveWindow = protocol.DefaultInitialMaxStreamData } maxReceiveStreamFlowControlWindow := config.MaxReceiveStreamFlowControlWindow if maxReceiveStreamFlowControlWindow == 0 { maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow } - initialConnectionFlowControlWindow := config.InitialConnectionFlowControlWindow - if initialConnectionFlowControlWindow == 0 { - initialConnectionFlowControlWindow = protocol.DefaultInitialMaxData + initialConnectionReceiveWindow := config.InitialConnectionReceiveWindow + if initialConnectionReceiveWindow == 0 { + initialConnectionReceiveWindow = protocol.DefaultInitialMaxData } maxReceiveConnectionFlowControlWindow := config.MaxReceiveConnectionFlowControlWindow if maxReceiveConnectionFlowControlWindow == 0 { @@ -106,9 +106,9 @@ func populateConfig(config *Config) *Config { MaxIdleTimeout: idleTimeout, AcceptToken: config.AcceptToken, KeepAlive: config.KeepAlive, - InitialStreamFlowControlWindow: initialStreamFlowControlWindow, + InitialStreamReceiveWindow: initialStreamReceiveWindow, MaxReceiveStreamFlowControlWindow: maxReceiveStreamFlowControlWindow, - InitialConnectionFlowControlWindow: initialConnectionFlowControlWindow, + InitialConnectionReceiveWindow: initialConnectionReceiveWindow, MaxReceiveConnectionFlowControlWindow: maxReceiveConnectionFlowControlWindow, MaxIncomingStreams: maxIncomingStreams, MaxIncomingUniStreams: maxIncomingUniStreams, diff --git a/config_test.go b/config_test.go index e5a1b04d..be49a589 100644 --- a/config_test.go +++ b/config_test.go @@ -57,11 +57,11 @@ var _ = Describe("Config", func() { f.Set(reflect.ValueOf(time.Hour)) case "TokenStore": f.Set(reflect.ValueOf(NewLRUTokenStore(2, 3))) - case "InitialStreamFlowControlWindow": + case "InitialStreamReceiveWindow": f.Set(reflect.ValueOf(uint64(1234))) case "MaxReceiveStreamFlowControlWindow": f.Set(reflect.ValueOf(uint64(9))) - case "InitialConnectionFlowControlWindow": + case "InitialConnectionReceiveWindow": f.Set(reflect.ValueOf(uint64(4321))) case "MaxReceiveConnectionFlowControlWindow": f.Set(reflect.ValueOf(uint64(10))) @@ -146,9 +146,9 @@ var _ = Describe("Config", func() { c := populateConfig(&Config{}) Expect(c.Versions).To(Equal(protocol.SupportedVersions)) Expect(c.HandshakeIdleTimeout).To(Equal(protocol.DefaultHandshakeIdleTimeout)) - Expect(c.InitialStreamFlowControlWindow).To(BeEquivalentTo(protocol.DefaultInitialMaxStreamData)) + Expect(c.InitialStreamReceiveWindow).To(BeEquivalentTo(protocol.DefaultInitialMaxStreamData)) Expect(c.MaxReceiveStreamFlowControlWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveStreamFlowControlWindow)) - Expect(c.InitialConnectionFlowControlWindow).To(BeEquivalentTo(protocol.DefaultInitialMaxData)) + Expect(c.InitialConnectionReceiveWindow).To(BeEquivalentTo(protocol.DefaultInitialMaxData)) Expect(c.MaxReceiveConnectionFlowControlWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveConnectionFlowControlWindow)) Expect(c.MaxIncomingStreams).To(BeEquivalentTo(protocol.DefaultMaxIncomingStreams)) Expect(c.MaxIncomingUniStreams).To(BeEquivalentTo(protocol.DefaultMaxIncomingUniStreams)) diff --git a/interface.go b/interface.go index 683107cc..a47f968d 100644 --- a/interface.go +++ b/interface.go @@ -255,19 +255,19 @@ type Config struct { // The key used to store tokens is the ServerName from the tls.Config, if set // otherwise the token is associated with the server's IP address. TokenStore TokenStore - // InitialStreamFlowControlWindow is the initial size of the stream-level flow control window for receiving data. + // InitialStreamReceiveWindow is the initial size of the stream-level flow control window for receiving data. // If the application is consuming data quickly enough, the flow control auto-tuning algorithm // will increase the window up to MaxReceiveStreamFlowControlWindow. // If this value is zero, it will default to 512 KB. - InitialStreamFlowControlWindow uint64 + InitialStreamReceiveWindow uint64 // MaxReceiveStreamFlowControlWindow is the maximum stream-level flow control window for receiving data. // If this value is zero, it will default to 6 MB. MaxReceiveStreamFlowControlWindow uint64 - // InitialConnectionFlowControlWindow is the initial size of the stream-level flow control window for receiving data. + // InitialConnectionReceiveWindow is the initial size of the stream-level flow control window for receiving data. // If the application is consuming data quickly enough, the flow control auto-tuning algorithm // will increase the window up to MaxReceiveConnectionFlowControlWindow. // If this value is zero, it will default to 512 KB. - InitialConnectionFlowControlWindow uint64 + InitialConnectionReceiveWindow uint64 // MaxReceiveConnectionFlowControlWindow is the connection-level flow control window for receiving data. // If this value is zero, it will default to 15 MB. MaxReceiveConnectionFlowControlWindow uint64 diff --git a/session.go b/session.go index 864573e3..cf2e84ed 100644 --- a/session.go +++ b/session.go @@ -302,10 +302,10 @@ var newSession = func( initialStream := newCryptoStream() handshakeStream := newCryptoStream() params := &wire.TransportParameters{ - InitialMaxStreamDataBidiLocal: protocol.ByteCount(s.config.InitialStreamFlowControlWindow), - InitialMaxStreamDataBidiRemote: protocol.ByteCount(s.config.InitialStreamFlowControlWindow), - InitialMaxStreamDataUni: protocol.ByteCount(s.config.InitialStreamFlowControlWindow), - InitialMaxData: protocol.ByteCount(s.config.InitialConnectionFlowControlWindow), + InitialMaxStreamDataBidiLocal: protocol.ByteCount(s.config.InitialStreamReceiveWindow), + InitialMaxStreamDataBidiRemote: protocol.ByteCount(s.config.InitialStreamReceiveWindow), + InitialMaxStreamDataUni: protocol.ByteCount(s.config.InitialStreamReceiveWindow), + InitialMaxData: protocol.ByteCount(s.config.InitialConnectionReceiveWindow), MaxIdleTimeout: s.config.MaxIdleTimeout, MaxBidiStreamNum: protocol.StreamNum(s.config.MaxIncomingStreams), MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams), @@ -426,10 +426,10 @@ var newClientSession = func( initialStream := newCryptoStream() handshakeStream := newCryptoStream() params := &wire.TransportParameters{ - InitialMaxStreamDataBidiRemote: protocol.ByteCount(s.config.InitialStreamFlowControlWindow), - InitialMaxStreamDataBidiLocal: protocol.ByteCount(s.config.InitialStreamFlowControlWindow), - InitialMaxStreamDataUni: protocol.ByteCount(s.config.InitialStreamFlowControlWindow), - InitialMaxData: protocol.ByteCount(s.config.InitialConnectionFlowControlWindow), + InitialMaxStreamDataBidiRemote: protocol.ByteCount(s.config.InitialStreamReceiveWindow), + InitialMaxStreamDataBidiLocal: protocol.ByteCount(s.config.InitialStreamReceiveWindow), + InitialMaxStreamDataUni: protocol.ByteCount(s.config.InitialStreamReceiveWindow), + InitialMaxData: protocol.ByteCount(s.config.InitialConnectionReceiveWindow), MaxIdleTimeout: s.config.MaxIdleTimeout, MaxBidiStreamNum: protocol.StreamNum(s.config.MaxIncomingStreams), MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams), @@ -503,7 +503,7 @@ func (s *session) preSetup() { s.frameParser = wire.NewFrameParser(s.config.EnableDatagrams, s.version) s.rttStats = &utils.RTTStats{} s.connFlowController = flowcontrol.NewConnectionFlowController( - protocol.ByteCount(s.config.InitialConnectionFlowControlWindow), + protocol.ByteCount(s.config.InitialConnectionReceiveWindow), protocol.ByteCount(s.config.MaxReceiveConnectionFlowControlWindow), s.onHasConnectionWindowUpdate, s.rttStats, @@ -1834,7 +1834,7 @@ func (s *session) newFlowController(id protocol.StreamID) flowcontrol.StreamFlow return flowcontrol.NewStreamFlowController( id, s.connFlowController, - protocol.ByteCount(s.config.InitialStreamFlowControlWindow), + protocol.ByteCount(s.config.InitialStreamReceiveWindow), protocol.ByteCount(s.config.MaxReceiveStreamFlowControlWindow), initialSendWindow, s.onHasStreamWindowUpdate, From 7ea53e6c2cdb12c946e46987086437db3c77c61c Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 13 Mar 2021 11:23:44 +0800 Subject: [PATCH 2/2] rename the Config values for Max{Stream, Connection}ReceiveWindow --- config.go | 46 +++++++++++++++++++++++----------------------- config_test.go | 8 ++++---- interface.go | 12 ++++++------ session.go | 4 ++-- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/config.go b/config.go index 10a4afa2..61ee7a21 100644 --- a/config.go +++ b/config.go @@ -75,17 +75,17 @@ func populateConfig(config *Config) *Config { if initialStreamReceiveWindow == 0 { initialStreamReceiveWindow = protocol.DefaultInitialMaxStreamData } - maxReceiveStreamFlowControlWindow := config.MaxReceiveStreamFlowControlWindow - if maxReceiveStreamFlowControlWindow == 0 { - maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow + maxStreamReceiveWindow := config.MaxStreamReceiveWindow + if maxStreamReceiveWindow == 0 { + maxStreamReceiveWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow } initialConnectionReceiveWindow := config.InitialConnectionReceiveWindow if initialConnectionReceiveWindow == 0 { initialConnectionReceiveWindow = protocol.DefaultInitialMaxData } - maxReceiveConnectionFlowControlWindow := config.MaxReceiveConnectionFlowControlWindow - if maxReceiveConnectionFlowControlWindow == 0 { - maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindow + maxConnectionReceiveWindow := config.MaxConnectionReceiveWindow + if maxConnectionReceiveWindow == 0 { + maxConnectionReceiveWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindow } maxIncomingStreams := config.MaxIncomingStreams if maxIncomingStreams == 0 { @@ -101,22 +101,22 @@ func populateConfig(config *Config) *Config { } return &Config{ - Versions: versions, - HandshakeIdleTimeout: handshakeIdleTimeout, - MaxIdleTimeout: idleTimeout, - AcceptToken: config.AcceptToken, - KeepAlive: config.KeepAlive, - InitialStreamReceiveWindow: initialStreamReceiveWindow, - MaxReceiveStreamFlowControlWindow: maxReceiveStreamFlowControlWindow, - InitialConnectionReceiveWindow: initialConnectionReceiveWindow, - MaxReceiveConnectionFlowControlWindow: maxReceiveConnectionFlowControlWindow, - MaxIncomingStreams: maxIncomingStreams, - MaxIncomingUniStreams: maxIncomingUniStreams, - ConnectionIDLength: config.ConnectionIDLength, - StatelessResetKey: config.StatelessResetKey, - TokenStore: config.TokenStore, - EnableDatagrams: config.EnableDatagrams, - DisablePathMTUDiscovery: config.DisablePathMTUDiscovery, - Tracer: config.Tracer, + Versions: versions, + HandshakeIdleTimeout: handshakeIdleTimeout, + MaxIdleTimeout: idleTimeout, + AcceptToken: config.AcceptToken, + KeepAlive: config.KeepAlive, + InitialStreamReceiveWindow: initialStreamReceiveWindow, + MaxStreamReceiveWindow: maxStreamReceiveWindow, + InitialConnectionReceiveWindow: initialConnectionReceiveWindow, + MaxConnectionReceiveWindow: maxConnectionReceiveWindow, + MaxIncomingStreams: maxIncomingStreams, + MaxIncomingUniStreams: maxIncomingUniStreams, + ConnectionIDLength: config.ConnectionIDLength, + StatelessResetKey: config.StatelessResetKey, + TokenStore: config.TokenStore, + EnableDatagrams: config.EnableDatagrams, + DisablePathMTUDiscovery: config.DisablePathMTUDiscovery, + Tracer: config.Tracer, } } diff --git a/config_test.go b/config_test.go index be49a589..6cb2ce91 100644 --- a/config_test.go +++ b/config_test.go @@ -59,11 +59,11 @@ var _ = Describe("Config", func() { f.Set(reflect.ValueOf(NewLRUTokenStore(2, 3))) case "InitialStreamReceiveWindow": f.Set(reflect.ValueOf(uint64(1234))) - case "MaxReceiveStreamFlowControlWindow": + case "MaxStreamReceiveWindow": f.Set(reflect.ValueOf(uint64(9))) case "InitialConnectionReceiveWindow": f.Set(reflect.ValueOf(uint64(4321))) - case "MaxReceiveConnectionFlowControlWindow": + case "MaxConnectionReceiveWindow": f.Set(reflect.ValueOf(uint64(10))) case "MaxIncomingStreams": f.Set(reflect.ValueOf(int64(11))) @@ -147,9 +147,9 @@ var _ = Describe("Config", func() { Expect(c.Versions).To(Equal(protocol.SupportedVersions)) Expect(c.HandshakeIdleTimeout).To(Equal(protocol.DefaultHandshakeIdleTimeout)) Expect(c.InitialStreamReceiveWindow).To(BeEquivalentTo(protocol.DefaultInitialMaxStreamData)) - Expect(c.MaxReceiveStreamFlowControlWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveStreamFlowControlWindow)) + Expect(c.MaxStreamReceiveWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveStreamFlowControlWindow)) Expect(c.InitialConnectionReceiveWindow).To(BeEquivalentTo(protocol.DefaultInitialMaxData)) - Expect(c.MaxReceiveConnectionFlowControlWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveConnectionFlowControlWindow)) + Expect(c.MaxConnectionReceiveWindow).To(BeEquivalentTo(protocol.DefaultMaxReceiveConnectionFlowControlWindow)) Expect(c.MaxIncomingStreams).To(BeEquivalentTo(protocol.DefaultMaxIncomingStreams)) Expect(c.MaxIncomingUniStreams).To(BeEquivalentTo(protocol.DefaultMaxIncomingUniStreams)) Expect(c.DisablePathMTUDiscovery).To(BeFalse()) diff --git a/interface.go b/interface.go index a47f968d..cae18cd4 100644 --- a/interface.go +++ b/interface.go @@ -257,20 +257,20 @@ type Config struct { TokenStore TokenStore // InitialStreamReceiveWindow is the initial size of the stream-level flow control window for receiving data. // If the application is consuming data quickly enough, the flow control auto-tuning algorithm - // will increase the window up to MaxReceiveStreamFlowControlWindow. + // will increase the window up to MaxStreamReceiveWindow. // If this value is zero, it will default to 512 KB. InitialStreamReceiveWindow uint64 - // MaxReceiveStreamFlowControlWindow is the maximum stream-level flow control window for receiving data. + // MaxStreamReceiveWindow is the maximum stream-level flow control window for receiving data. // If this value is zero, it will default to 6 MB. - MaxReceiveStreamFlowControlWindow uint64 + MaxStreamReceiveWindow uint64 // InitialConnectionReceiveWindow is the initial size of the stream-level flow control window for receiving data. // If the application is consuming data quickly enough, the flow control auto-tuning algorithm - // will increase the window up to MaxReceiveConnectionFlowControlWindow. + // will increase the window up to MaxConnectionReceiveWindow. // If this value is zero, it will default to 512 KB. InitialConnectionReceiveWindow uint64 - // MaxReceiveConnectionFlowControlWindow is the connection-level flow control window for receiving data. + // MaxConnectionReceiveWindow is the connection-level flow control window for receiving data. // If this value is zero, it will default to 15 MB. - MaxReceiveConnectionFlowControlWindow uint64 + MaxConnectionReceiveWindow uint64 // MaxIncomingStreams is the maximum number of concurrent bidirectional streams that a peer is allowed to open. // Values above 2^60 are invalid. // If not set, it will default to 100. diff --git a/session.go b/session.go index cf2e84ed..4cc70238 100644 --- a/session.go +++ b/session.go @@ -504,7 +504,7 @@ func (s *session) preSetup() { s.rttStats = &utils.RTTStats{} s.connFlowController = flowcontrol.NewConnectionFlowController( protocol.ByteCount(s.config.InitialConnectionReceiveWindow), - protocol.ByteCount(s.config.MaxReceiveConnectionFlowControlWindow), + protocol.ByteCount(s.config.MaxConnectionReceiveWindow), s.onHasConnectionWindowUpdate, s.rttStats, s.logger, @@ -1835,7 +1835,7 @@ func (s *session) newFlowController(id protocol.StreamID) flowcontrol.StreamFlow id, s.connFlowController, protocol.ByteCount(s.config.InitialStreamReceiveWindow), - protocol.ByteCount(s.config.MaxReceiveStreamFlowControlWindow), + protocol.ByteCount(s.config.MaxStreamReceiveWindow), initialSendWindow, s.onHasStreamWindowUpdate, s.rttStats,