From 354bbb0e2ec710381e29559cf07f9d6d60349cb9 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 13 Mar 2021 11:21:11 +0800 Subject: [PATCH] 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 886ef0d60..10a4afa20 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 e5a1b04dc..be49a589f 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 683107cc7..a47f968d0 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 864573e3d..cf2e84edd 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,