diff --git a/internal/handshake/crypto_setup_client_test.go b/internal/handshake/crypto_setup_client_test.go index cebf1d0e..93fac228 100644 --- a/internal/handshake/crypto_setup_client_test.go +++ b/internal/handshake/crypto_setup_client_test.go @@ -440,7 +440,7 @@ var _ = Describe("Client Crypto Setup", func() { shloMap[TagICSL] = []byte{3, 0, 0, 0} // 3 seconds err := cs.handleSHLOMessage(shloMap) Expect(err).ToNot(HaveOccurred()) - Expect(cs.params.GetIdleConnectionStateLifetime()).To(Equal(3 * time.Second)) + Expect(cs.params.GetRemoteIdleTimeout()).To(Equal(3 * time.Second)) }) It("errors if it can't read a connection parameter", func() { diff --git a/internal/handshake/params_negotiator_base.go b/internal/handshake/params_negotiator_base.go index 3540e288..1cc8c49b 100644 --- a/internal/handshake/params_negotiator_base.go +++ b/internal/handshake/params_negotiator_base.go @@ -20,7 +20,7 @@ type ParamsNegotiator interface { GetMaxOutgoingStreams() uint32 GetMaxIncomingStreams() uint32 // get the idle timeout that was sent by the peer - GetIdleConnectionStateLifetime() time.Duration + GetRemoteIdleTimeout() time.Duration // determines if the client requests omission of connection IDs. OmitConnectionID() bool } @@ -132,7 +132,7 @@ func (h *paramsNegotiatorBase) GetMaxIncomingStreams() uint32 { return utils.MaxUint32(uint32(maxStreams)+protocol.MaxStreamsMinimumIncrement, uint32(float64(maxStreams)*protocol.MaxStreamsMultiplier)) } -func (h *paramsNegotiatorBase) GetIdleConnectionStateLifetime() time.Duration { +func (h *paramsNegotiatorBase) GetRemoteIdleTimeout() time.Duration { h.mutex.RLock() defer h.mutex.RUnlock() return h.remoteIdleTimeout diff --git a/internal/handshake/params_negotiator_gquic_test.go b/internal/handshake/params_negotiator_gquic_test.go index f150efba..3c2cf845 100644 --- a/internal/handshake/params_negotiator_gquic_test.go +++ b/internal/handshake/params_negotiator_gquic_test.go @@ -218,7 +218,7 @@ var _ = Describe("Params Negotiator (for gQUIC)", func() { } err := pn.SetFromMap(values) Expect(err).ToNot(HaveOccurred()) - Expect(pn.GetIdleConnectionStateLifetime()).To(Equal(10 * time.Second)) + Expect(pn.GetRemoteIdleTimeout()).To(Equal(10 * time.Second)) }) It("errors when given an invalid value", func() { diff --git a/internal/handshake/params_negotiator_test.go b/internal/handshake/params_negotiator_test.go index cce62063..2298b811 100644 --- a/internal/handshake/params_negotiator_test.go +++ b/internal/handshake/params_negotiator_test.go @@ -71,7 +71,7 @@ var _ = Describe("Params Negotiator (for TLS)", func() { Expect(err).ToNot(HaveOccurred()) Expect(pn.GetSendStreamFlowControlWindow()).To(Equal(protocol.ByteCount(0x11223344))) Expect(pn.GetSendConnectionFlowControlWindow()).To(Equal(protocol.ByteCount(0x22334455))) - Expect(pn.GetIdleConnectionStateLifetime()).To(Equal(0x1337 * time.Second)) + Expect(pn.GetRemoteIdleTimeout()).To(Equal(0x1337 * time.Second)) Expect(pn.OmitConnectionID()).To(BeFalse()) }) diff --git a/internal/mocks/mocks_fc/flow_control_manager.go b/internal/mocks/mocks_fc/flow_control_manager.go index e0f1d213..8089da47 100644 --- a/internal/mocks/mocks_fc/flow_control_manager.go +++ b/internal/mocks/mocks_fc/flow_control_manager.go @@ -1,6 +1,7 @@ // Code generated by MockGen. DO NOT EDIT. // Source: ../flowcontrol/interface.go +// Package mocks_fc is a generated GoMock package. package mocks_fc import ( @@ -30,137 +31,137 @@ func NewMockFlowControlManager(ctrl *gomock.Controller) *MockFlowControlManager } // EXPECT returns an object that allows the caller to indicate expected use -func (_m *MockFlowControlManager) EXPECT() *MockFlowControlManagerMockRecorder { - return _m.recorder +func (m *MockFlowControlManager) EXPECT() *MockFlowControlManagerMockRecorder { + return m.recorder } // NewStream mocks base method -func (_m *MockFlowControlManager) NewStream(streamID protocol.StreamID, contributesToConnectionFlow bool) { - _m.ctrl.Call(_m, "NewStream", streamID, contributesToConnectionFlow) +func (m *MockFlowControlManager) NewStream(streamID protocol.StreamID, contributesToConnectionFlow bool) { + m.ctrl.Call(m, "NewStream", streamID, contributesToConnectionFlow) } // NewStream indicates an expected call of NewStream -func (_mr *MockFlowControlManagerMockRecorder) NewStream(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "NewStream", reflect.TypeOf((*MockFlowControlManager)(nil).NewStream), arg0, arg1) +func (mr *MockFlowControlManagerMockRecorder) NewStream(streamID, contributesToConnectionFlow interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewStream", reflect.TypeOf((*MockFlowControlManager)(nil).NewStream), streamID, contributesToConnectionFlow) } // RemoveStream mocks base method -func (_m *MockFlowControlManager) RemoveStream(streamID protocol.StreamID) { - _m.ctrl.Call(_m, "RemoveStream", streamID) +func (m *MockFlowControlManager) RemoveStream(streamID protocol.StreamID) { + m.ctrl.Call(m, "RemoveStream", streamID) } // RemoveStream indicates an expected call of RemoveStream -func (_mr *MockFlowControlManagerMockRecorder) RemoveStream(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "RemoveStream", reflect.TypeOf((*MockFlowControlManager)(nil).RemoveStream), arg0) +func (mr *MockFlowControlManagerMockRecorder) RemoveStream(streamID interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveStream", reflect.TypeOf((*MockFlowControlManager)(nil).RemoveStream), streamID) } // ResetStream mocks base method -func (_m *MockFlowControlManager) ResetStream(streamID protocol.StreamID, byteOffset protocol.ByteCount) error { - ret := _m.ctrl.Call(_m, "ResetStream", streamID, byteOffset) +func (m *MockFlowControlManager) ResetStream(streamID protocol.StreamID, byteOffset protocol.ByteCount) error { + ret := m.ctrl.Call(m, "ResetStream", streamID, byteOffset) ret0, _ := ret[0].(error) return ret0 } // ResetStream indicates an expected call of ResetStream -func (_mr *MockFlowControlManagerMockRecorder) ResetStream(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ResetStream", reflect.TypeOf((*MockFlowControlManager)(nil).ResetStream), arg0, arg1) +func (mr *MockFlowControlManagerMockRecorder) ResetStream(streamID, byteOffset interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetStream", reflect.TypeOf((*MockFlowControlManager)(nil).ResetStream), streamID, byteOffset) } // UpdateHighestReceived mocks base method -func (_m *MockFlowControlManager) UpdateHighestReceived(streamID protocol.StreamID, byteOffset protocol.ByteCount) error { - ret := _m.ctrl.Call(_m, "UpdateHighestReceived", streamID, byteOffset) +func (m *MockFlowControlManager) UpdateHighestReceived(streamID protocol.StreamID, byteOffset protocol.ByteCount) error { + ret := m.ctrl.Call(m, "UpdateHighestReceived", streamID, byteOffset) ret0, _ := ret[0].(error) return ret0 } // UpdateHighestReceived indicates an expected call of UpdateHighestReceived -func (_mr *MockFlowControlManagerMockRecorder) UpdateHighestReceived(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "UpdateHighestReceived", reflect.TypeOf((*MockFlowControlManager)(nil).UpdateHighestReceived), arg0, arg1) +func (mr *MockFlowControlManagerMockRecorder) UpdateHighestReceived(streamID, byteOffset interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHighestReceived", reflect.TypeOf((*MockFlowControlManager)(nil).UpdateHighestReceived), streamID, byteOffset) } // AddBytesRead mocks base method -func (_m *MockFlowControlManager) AddBytesRead(streamID protocol.StreamID, n protocol.ByteCount) error { - ret := _m.ctrl.Call(_m, "AddBytesRead", streamID, n) +func (m *MockFlowControlManager) AddBytesRead(streamID protocol.StreamID, n protocol.ByteCount) error { + ret := m.ctrl.Call(m, "AddBytesRead", streamID, n) ret0, _ := ret[0].(error) return ret0 } // AddBytesRead indicates an expected call of AddBytesRead -func (_mr *MockFlowControlManagerMockRecorder) AddBytesRead(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "AddBytesRead", reflect.TypeOf((*MockFlowControlManager)(nil).AddBytesRead), arg0, arg1) +func (mr *MockFlowControlManagerMockRecorder) AddBytesRead(streamID, n interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBytesRead", reflect.TypeOf((*MockFlowControlManager)(nil).AddBytesRead), streamID, n) } // GetWindowUpdates mocks base method -func (_m *MockFlowControlManager) GetWindowUpdates() []flowcontrol.WindowUpdate { - ret := _m.ctrl.Call(_m, "GetWindowUpdates") +func (m *MockFlowControlManager) GetWindowUpdates() []flowcontrol.WindowUpdate { + ret := m.ctrl.Call(m, "GetWindowUpdates") ret0, _ := ret[0].([]flowcontrol.WindowUpdate) return ret0 } // GetWindowUpdates indicates an expected call of GetWindowUpdates -func (_mr *MockFlowControlManagerMockRecorder) GetWindowUpdates() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetWindowUpdates", reflect.TypeOf((*MockFlowControlManager)(nil).GetWindowUpdates)) +func (mr *MockFlowControlManagerMockRecorder) GetWindowUpdates() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWindowUpdates", reflect.TypeOf((*MockFlowControlManager)(nil).GetWindowUpdates)) } // GetReceiveWindow mocks base method -func (_m *MockFlowControlManager) GetReceiveWindow(streamID protocol.StreamID) (protocol.ByteCount, error) { - ret := _m.ctrl.Call(_m, "GetReceiveWindow", streamID) +func (m *MockFlowControlManager) GetReceiveWindow(streamID protocol.StreamID) (protocol.ByteCount, error) { + ret := m.ctrl.Call(m, "GetReceiveWindow", streamID) ret0, _ := ret[0].(protocol.ByteCount) ret1, _ := ret[1].(error) return ret0, ret1 } // GetReceiveWindow indicates an expected call of GetReceiveWindow -func (_mr *MockFlowControlManagerMockRecorder) GetReceiveWindow(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetReceiveWindow", reflect.TypeOf((*MockFlowControlManager)(nil).GetReceiveWindow), arg0) +func (mr *MockFlowControlManagerMockRecorder) GetReceiveWindow(streamID interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceiveWindow", reflect.TypeOf((*MockFlowControlManager)(nil).GetReceiveWindow), streamID) } // AddBytesSent mocks base method -func (_m *MockFlowControlManager) AddBytesSent(streamID protocol.StreamID, n protocol.ByteCount) error { - ret := _m.ctrl.Call(_m, "AddBytesSent", streamID, n) +func (m *MockFlowControlManager) AddBytesSent(streamID protocol.StreamID, n protocol.ByteCount) error { + ret := m.ctrl.Call(m, "AddBytesSent", streamID, n) ret0, _ := ret[0].(error) return ret0 } // AddBytesSent indicates an expected call of AddBytesSent -func (_mr *MockFlowControlManagerMockRecorder) AddBytesSent(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "AddBytesSent", reflect.TypeOf((*MockFlowControlManager)(nil).AddBytesSent), arg0, arg1) +func (mr *MockFlowControlManagerMockRecorder) AddBytesSent(streamID, n interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBytesSent", reflect.TypeOf((*MockFlowControlManager)(nil).AddBytesSent), streamID, n) } // SendWindowSize mocks base method -func (_m *MockFlowControlManager) SendWindowSize(streamID protocol.StreamID) (protocol.ByteCount, error) { - ret := _m.ctrl.Call(_m, "SendWindowSize", streamID) +func (m *MockFlowControlManager) SendWindowSize(streamID protocol.StreamID) (protocol.ByteCount, error) { + ret := m.ctrl.Call(m, "SendWindowSize", streamID) ret0, _ := ret[0].(protocol.ByteCount) ret1, _ := ret[1].(error) return ret0, ret1 } // SendWindowSize indicates an expected call of SendWindowSize -func (_mr *MockFlowControlManagerMockRecorder) SendWindowSize(arg0 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "SendWindowSize", reflect.TypeOf((*MockFlowControlManager)(nil).SendWindowSize), arg0) +func (mr *MockFlowControlManagerMockRecorder) SendWindowSize(streamID interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendWindowSize", reflect.TypeOf((*MockFlowControlManager)(nil).SendWindowSize), streamID) } // RemainingConnectionWindowSize mocks base method -func (_m *MockFlowControlManager) RemainingConnectionWindowSize() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "RemainingConnectionWindowSize") +func (m *MockFlowControlManager) RemainingConnectionWindowSize() protocol.ByteCount { + ret := m.ctrl.Call(m, "RemainingConnectionWindowSize") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // RemainingConnectionWindowSize indicates an expected call of RemainingConnectionWindowSize -func (_mr *MockFlowControlManagerMockRecorder) RemainingConnectionWindowSize() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "RemainingConnectionWindowSize", reflect.TypeOf((*MockFlowControlManager)(nil).RemainingConnectionWindowSize)) +func (mr *MockFlowControlManagerMockRecorder) RemainingConnectionWindowSize() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemainingConnectionWindowSize", reflect.TypeOf((*MockFlowControlManager)(nil).RemainingConnectionWindowSize)) } // UpdateWindow mocks base method -func (_m *MockFlowControlManager) UpdateWindow(streamID protocol.StreamID, offset protocol.ByteCount) (bool, error) { - ret := _m.ctrl.Call(_m, "UpdateWindow", streamID, offset) +func (m *MockFlowControlManager) UpdateWindow(streamID protocol.StreamID, offset protocol.ByteCount) (bool, error) { + ret := m.ctrl.Call(m, "UpdateWindow", streamID, offset) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateWindow indicates an expected call of UpdateWindow -func (_mr *MockFlowControlManagerMockRecorder) UpdateWindow(arg0, arg1 interface{}) *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "UpdateWindow", reflect.TypeOf((*MockFlowControlManager)(nil).UpdateWindow), arg0, arg1) +func (mr *MockFlowControlManagerMockRecorder) UpdateWindow(streamID, offset interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWindow", reflect.TypeOf((*MockFlowControlManager)(nil).UpdateWindow), streamID, offset) } diff --git a/internal/mocks/params_negotiator.go b/internal/mocks/params_negotiator.go index 97f99bac..a1b141d3 100644 --- a/internal/mocks/params_negotiator.go +++ b/internal/mocks/params_negotiator.go @@ -1,14 +1,14 @@ // Code generated by MockGen. DO NOT EDIT. // Source: ../handshake/params_negotiator_base.go +// Package mocks is a generated GoMock package. package mocks import ( - reflect "reflect" - time "time" - gomock "github.com/golang/mock/gomock" protocol "github.com/lucas-clemente/quic-go/internal/protocol" + reflect "reflect" + time "time" ) // MockParamsNegotiator is a mock of ParamsNegotiator interface @@ -30,126 +30,126 @@ func NewMockParamsNegotiator(ctrl *gomock.Controller) *MockParamsNegotiator { } // EXPECT returns an object that allows the caller to indicate expected use -func (_m *MockParamsNegotiator) EXPECT() *MockParamsNegotiatorMockRecorder { - return _m.recorder +func (m *MockParamsNegotiator) EXPECT() *MockParamsNegotiatorMockRecorder { + return m.recorder } // GetSendStreamFlowControlWindow mocks base method -func (_m *MockParamsNegotiator) GetSendStreamFlowControlWindow() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "GetSendStreamFlowControlWindow") +func (m *MockParamsNegotiator) GetSendStreamFlowControlWindow() protocol.ByteCount { + ret := m.ctrl.Call(m, "GetSendStreamFlowControlWindow") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // GetSendStreamFlowControlWindow indicates an expected call of GetSendStreamFlowControlWindow -func (_mr *MockParamsNegotiatorMockRecorder) GetSendStreamFlowControlWindow() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetSendStreamFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetSendStreamFlowControlWindow)) +func (mr *MockParamsNegotiatorMockRecorder) GetSendStreamFlowControlWindow() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSendStreamFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetSendStreamFlowControlWindow)) } // GetSendConnectionFlowControlWindow mocks base method -func (_m *MockParamsNegotiator) GetSendConnectionFlowControlWindow() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "GetSendConnectionFlowControlWindow") +func (m *MockParamsNegotiator) GetSendConnectionFlowControlWindow() protocol.ByteCount { + ret := m.ctrl.Call(m, "GetSendConnectionFlowControlWindow") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // GetSendConnectionFlowControlWindow indicates an expected call of GetSendConnectionFlowControlWindow -func (_mr *MockParamsNegotiatorMockRecorder) GetSendConnectionFlowControlWindow() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetSendConnectionFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetSendConnectionFlowControlWindow)) +func (mr *MockParamsNegotiatorMockRecorder) GetSendConnectionFlowControlWindow() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSendConnectionFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetSendConnectionFlowControlWindow)) } // GetReceiveStreamFlowControlWindow mocks base method -func (_m *MockParamsNegotiator) GetReceiveStreamFlowControlWindow() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "GetReceiveStreamFlowControlWindow") +func (m *MockParamsNegotiator) GetReceiveStreamFlowControlWindow() protocol.ByteCount { + ret := m.ctrl.Call(m, "GetReceiveStreamFlowControlWindow") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // GetReceiveStreamFlowControlWindow indicates an expected call of GetReceiveStreamFlowControlWindow -func (_mr *MockParamsNegotiatorMockRecorder) GetReceiveStreamFlowControlWindow() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetReceiveStreamFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetReceiveStreamFlowControlWindow)) +func (mr *MockParamsNegotiatorMockRecorder) GetReceiveStreamFlowControlWindow() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceiveStreamFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetReceiveStreamFlowControlWindow)) } // GetMaxReceiveStreamFlowControlWindow mocks base method -func (_m *MockParamsNegotiator) GetMaxReceiveStreamFlowControlWindow() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "GetMaxReceiveStreamFlowControlWindow") +func (m *MockParamsNegotiator) GetMaxReceiveStreamFlowControlWindow() protocol.ByteCount { + ret := m.ctrl.Call(m, "GetMaxReceiveStreamFlowControlWindow") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // GetMaxReceiveStreamFlowControlWindow indicates an expected call of GetMaxReceiveStreamFlowControlWindow -func (_mr *MockParamsNegotiatorMockRecorder) GetMaxReceiveStreamFlowControlWindow() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetMaxReceiveStreamFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxReceiveStreamFlowControlWindow)) +func (mr *MockParamsNegotiatorMockRecorder) GetMaxReceiveStreamFlowControlWindow() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMaxReceiveStreamFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxReceiveStreamFlowControlWindow)) } // GetReceiveConnectionFlowControlWindow mocks base method -func (_m *MockParamsNegotiator) GetReceiveConnectionFlowControlWindow() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "GetReceiveConnectionFlowControlWindow") +func (m *MockParamsNegotiator) GetReceiveConnectionFlowControlWindow() protocol.ByteCount { + ret := m.ctrl.Call(m, "GetReceiveConnectionFlowControlWindow") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // GetReceiveConnectionFlowControlWindow indicates an expected call of GetReceiveConnectionFlowControlWindow -func (_mr *MockParamsNegotiatorMockRecorder) GetReceiveConnectionFlowControlWindow() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetReceiveConnectionFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetReceiveConnectionFlowControlWindow)) +func (mr *MockParamsNegotiatorMockRecorder) GetReceiveConnectionFlowControlWindow() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceiveConnectionFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetReceiveConnectionFlowControlWindow)) } // GetMaxReceiveConnectionFlowControlWindow mocks base method -func (_m *MockParamsNegotiator) GetMaxReceiveConnectionFlowControlWindow() protocol.ByteCount { - ret := _m.ctrl.Call(_m, "GetMaxReceiveConnectionFlowControlWindow") +func (m *MockParamsNegotiator) GetMaxReceiveConnectionFlowControlWindow() protocol.ByteCount { + ret := m.ctrl.Call(m, "GetMaxReceiveConnectionFlowControlWindow") ret0, _ := ret[0].(protocol.ByteCount) return ret0 } // GetMaxReceiveConnectionFlowControlWindow indicates an expected call of GetMaxReceiveConnectionFlowControlWindow -func (_mr *MockParamsNegotiatorMockRecorder) GetMaxReceiveConnectionFlowControlWindow() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetMaxReceiveConnectionFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxReceiveConnectionFlowControlWindow)) +func (mr *MockParamsNegotiatorMockRecorder) GetMaxReceiveConnectionFlowControlWindow() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMaxReceiveConnectionFlowControlWindow", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxReceiveConnectionFlowControlWindow)) } // GetMaxOutgoingStreams mocks base method -func (_m *MockParamsNegotiator) GetMaxOutgoingStreams() uint32 { - ret := _m.ctrl.Call(_m, "GetMaxOutgoingStreams") +func (m *MockParamsNegotiator) GetMaxOutgoingStreams() uint32 { + ret := m.ctrl.Call(m, "GetMaxOutgoingStreams") ret0, _ := ret[0].(uint32) return ret0 } // GetMaxOutgoingStreams indicates an expected call of GetMaxOutgoingStreams -func (_mr *MockParamsNegotiatorMockRecorder) GetMaxOutgoingStreams() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetMaxOutgoingStreams", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxOutgoingStreams)) +func (mr *MockParamsNegotiatorMockRecorder) GetMaxOutgoingStreams() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMaxOutgoingStreams", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxOutgoingStreams)) } // GetMaxIncomingStreams mocks base method -func (_m *MockParamsNegotiator) GetMaxIncomingStreams() uint32 { - ret := _m.ctrl.Call(_m, "GetMaxIncomingStreams") +func (m *MockParamsNegotiator) GetMaxIncomingStreams() uint32 { + ret := m.ctrl.Call(m, "GetMaxIncomingStreams") ret0, _ := ret[0].(uint32) return ret0 } // GetMaxIncomingStreams indicates an expected call of GetMaxIncomingStreams -func (_mr *MockParamsNegotiatorMockRecorder) GetMaxIncomingStreams() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetMaxIncomingStreams", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxIncomingStreams)) +func (mr *MockParamsNegotiatorMockRecorder) GetMaxIncomingStreams() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMaxIncomingStreams", reflect.TypeOf((*MockParamsNegotiator)(nil).GetMaxIncomingStreams)) } -// GetIdleConnectionStateLifetime mocks base method -func (_m *MockParamsNegotiator) GetIdleConnectionStateLifetime() time.Duration { - ret := _m.ctrl.Call(_m, "GetIdleConnectionStateLifetime") +// GetRemoteIdleTimeout mocks base method +func (m *MockParamsNegotiator) GetRemoteIdleTimeout() time.Duration { + ret := m.ctrl.Call(m, "GetRemoteIdleTimeout") ret0, _ := ret[0].(time.Duration) return ret0 } -// GetIdleConnectionStateLifetime indicates an expected call of GetIdleConnectionStateLifetime -func (_mr *MockParamsNegotiatorMockRecorder) GetIdleConnectionStateLifetime() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetIdleConnectionStateLifetime", reflect.TypeOf((*MockParamsNegotiator)(nil).GetIdleConnectionStateLifetime)) +// GetRemoteIdleTimeout indicates an expected call of GetRemoteIdleTimeout +func (mr *MockParamsNegotiatorMockRecorder) GetRemoteIdleTimeout() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRemoteIdleTimeout", reflect.TypeOf((*MockParamsNegotiator)(nil).GetRemoteIdleTimeout)) } // OmitConnectionID mocks base method -func (_m *MockParamsNegotiator) OmitConnectionID() bool { - ret := _m.ctrl.Call(_m, "OmitConnectionID") +func (m *MockParamsNegotiator) OmitConnectionID() bool { + ret := m.ctrl.Call(m, "OmitConnectionID") ret0, _ := ret[0].(bool) return ret0 } // OmitConnectionID indicates an expected call of OmitConnectionID -func (_mr *MockParamsNegotiatorMockRecorder) OmitConnectionID() *gomock.Call { - return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "OmitConnectionID", reflect.TypeOf((*MockParamsNegotiator)(nil).OmitConnectionID)) +func (mr *MockParamsNegotiatorMockRecorder) OmitConnectionID() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OmitConnectionID", reflect.TypeOf((*MockParamsNegotiator)(nil).OmitConnectionID)) } diff --git a/session.go b/session.go index ccef802b..77840256 100644 --- a/session.go +++ b/session.go @@ -329,7 +329,7 @@ runLoop: s.sentPacketHandler.OnAlarm() } - if s.config.KeepAlive && s.handshakeComplete && time.Since(s.lastNetworkActivityTime) >= s.connParams.GetIdleConnectionStateLifetime()/2 { + if s.config.KeepAlive && s.handshakeComplete && time.Since(s.lastNetworkActivityTime) >= s.connParams.GetRemoteIdleTimeout()/2 { // send the PING frame since there is no activity in the session s.packer.QueueControlFrame(&wire.PingFrame{}) s.keepAlivePingSent = true @@ -368,7 +368,7 @@ func (s *session) Context() context.Context { func (s *session) maybeResetTimer() { var deadline time.Time if s.config.KeepAlive && s.handshakeComplete && !s.keepAlivePingSent { - deadline = s.lastNetworkActivityTime.Add(s.connParams.GetIdleConnectionStateLifetime() / 2) + deadline = s.lastNetworkActivityTime.Add(s.connParams.GetRemoteIdleTimeout() / 2) } else { deadline = s.lastNetworkActivityTime.Add(s.config.IdleTimeout) } diff --git a/session_test.go b/session_test.go index 7b19167a..f624b0d9 100644 --- a/session_test.go +++ b/session_test.go @@ -165,12 +165,10 @@ func (m *mockParamsNegotiator) GetReceiveConnectionFlowControlWindow() protocol. func (m *mockParamsNegotiator) GetMaxReceiveConnectionFlowControlWindow() protocol.ByteCount { return protocol.DefaultMaxReceiveConnectionFlowControlWindowServer } -func (m *mockParamsNegotiator) GetMaxOutgoingStreams() uint32 { return 100 } -func (m *mockParamsNegotiator) GetMaxIncomingStreams() uint32 { return 100 } -func (m *mockParamsNegotiator) GetIdleConnectionStateLifetime() time.Duration { - return time.Hour -} -func (m *mockParamsNegotiator) OmitConnectionID() bool { return false } +func (m *mockParamsNegotiator) GetMaxOutgoingStreams() uint32 { return 100 } +func (m *mockParamsNegotiator) GetMaxIncomingStreams() uint32 { return 100 } +func (m *mockParamsNegotiator) GetRemoteIdleTimeout() time.Duration { return time.Hour } +func (m *mockParamsNegotiator) OmitConnectionID() bool { return false } var _ = Describe("Session", func() { var ( @@ -1508,7 +1506,7 @@ var _ = Describe("Session", func() { BeforeEach(func() { mockPn = mocks.NewMockParamsNegotiator(mockCtrl) - mockPn.EXPECT().GetIdleConnectionStateLifetime().Return(remoteIdleTimeout).AnyTimes() + mockPn.EXPECT().GetRemoteIdleTimeout().Return(remoteIdleTimeout).AnyTimes() sess.connParams = mockPn })