remove unused error return value from HandleMaxStreamsFrame

This commit is contained in:
Marten Seemann 2021-03-07 11:07:10 +08:00
parent 3b916f2e80
commit 8a0b1dd78d
5 changed files with 12 additions and 24 deletions

View file

@ -123,11 +123,9 @@ func (mr *MockStreamManagerMockRecorder) GetOrOpenSendStream(arg0 interface{}) *
} }
// HandleMaxStreamsFrame mocks base method. // HandleMaxStreamsFrame mocks base method.
func (m *MockStreamManager) HandleMaxStreamsFrame(arg0 *wire.MaxStreamsFrame) error { func (m *MockStreamManager) HandleMaxStreamsFrame(arg0 *wire.MaxStreamsFrame) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HandleMaxStreamsFrame", arg0) m.ctrl.Call(m, "HandleMaxStreamsFrame", arg0)
ret0, _ := ret[0].(error)
return ret0
} }
// HandleMaxStreamsFrame indicates an expected call of HandleMaxStreamsFrame. // HandleMaxStreamsFrame indicates an expected call of HandleMaxStreamsFrame.

View file

@ -43,7 +43,7 @@ type streamManager interface {
AcceptUniStream(context.Context) (ReceiveStream, error) AcceptUniStream(context.Context) (ReceiveStream, error)
DeleteStream(protocol.StreamID) error DeleteStream(protocol.StreamID) error
UpdateLimits(*wire.TransportParameters) UpdateLimits(*wire.TransportParameters)
HandleMaxStreamsFrame(*wire.MaxStreamsFrame) error HandleMaxStreamsFrame(*wire.MaxStreamsFrame)
CloseWithError(error) CloseWithError(error)
} }
@ -1181,7 +1181,7 @@ func (s *session) handleFrame(f wire.Frame, encLevel protocol.EncryptionLevel, d
case *wire.MaxStreamDataFrame: case *wire.MaxStreamDataFrame:
err = s.handleMaxStreamDataFrame(frame) err = s.handleMaxStreamDataFrame(frame)
case *wire.MaxStreamsFrame: case *wire.MaxStreamsFrame:
err = s.handleMaxStreamsFrame(frame) s.handleMaxStreamsFrame(frame)
case *wire.DataBlockedFrame: case *wire.DataBlockedFrame:
case *wire.StreamDataBlockedFrame: case *wire.StreamDataBlockedFrame:
case *wire.StreamsBlockedFrame: case *wire.StreamsBlockedFrame:
@ -1275,8 +1275,8 @@ func (s *session) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) error
return nil return nil
} }
func (s *session) handleMaxStreamsFrame(frame *wire.MaxStreamsFrame) error { func (s *session) handleMaxStreamsFrame(frame *wire.MaxStreamsFrame) {
return s.streamsMap.HandleMaxStreamsFrame(frame) s.streamsMap.HandleMaxStreamsFrame(frame)
} }
func (s *session) handleResetStreamFrame(frame *wire.ResetStreamFrame) error { func (s *session) handleResetStreamFrame(frame *wire.ResetStreamFrame) error {

View file

@ -247,16 +247,7 @@ var _ = Describe("Session", func() {
MaxStreamNum: 10, MaxStreamNum: 10,
} }
streamManager.EXPECT().HandleMaxStreamsFrame(f) streamManager.EXPECT().HandleMaxStreamsFrame(f)
err := sess.handleMaxStreamsFrame(f) sess.handleMaxStreamsFrame(f)
Expect(err).ToNot(HaveOccurred())
})
It("returns errors", func() {
f := &wire.MaxStreamsFrame{MaxStreamNum: 10}
testErr := errors.New("test error")
streamManager.EXPECT().HandleMaxStreamsFrame(f).Return(testErr)
err := sess.handleMaxStreamsFrame(f)
Expect(err).To(MatchError(testErr))
}) })
}) })

View file

@ -212,14 +212,13 @@ func (m *streamsMap) getOrOpenSendStream(id protocol.StreamID) (sendStreamI, err
panic("") panic("")
} }
func (m *streamsMap) HandleMaxStreamsFrame(f *wire.MaxStreamsFrame) error { func (m *streamsMap) HandleMaxStreamsFrame(f *wire.MaxStreamsFrame) {
switch f.Type { switch f.Type {
case protocol.StreamTypeUni: case protocol.StreamTypeUni:
m.outgoingUniStreams.SetMaxStream(f.MaxStreamNum) m.outgoingUniStreams.SetMaxStream(f.MaxStreamNum)
case protocol.StreamTypeBidi: case protocol.StreamTypeBidi:
m.outgoingBidiStreams.SetMaxStream(f.MaxStreamNum) m.outgoingBidiStreams.SetMaxStream(f.MaxStreamNum)
} }
return nil
} }
func (m *streamsMap) UpdateLimits(p *wire.TransportParameters) { func (m *streamsMap) UpdateLimits(p *wire.TransportParameters) {

View file

@ -363,10 +363,10 @@ var _ = Describe("Streams Map", func() {
It("processes IDs for outgoing bidirectional streams", func() { It("processes IDs for outgoing bidirectional streams", func() {
_, err := m.OpenStream() _, err := m.OpenStream()
expectTooManyStreamsError(err) expectTooManyStreamsError(err)
Expect(m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{ m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{
Type: protocol.StreamTypeBidi, Type: protocol.StreamTypeBidi,
MaxStreamNum: 1, MaxStreamNum: 1,
})).To(Succeed()) })
str, err := m.OpenStream() str, err := m.OpenStream()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(str.StreamID()).To(Equal(ids.firstOutgoingBidiStream)) Expect(str.StreamID()).To(Equal(ids.firstOutgoingBidiStream))
@ -377,10 +377,10 @@ var _ = Describe("Streams Map", func() {
It("processes IDs for outgoing unidirectional streams", func() { It("processes IDs for outgoing unidirectional streams", func() {
_, err := m.OpenUniStream() _, err := m.OpenUniStream()
expectTooManyStreamsError(err) expectTooManyStreamsError(err)
Expect(m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{ m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{
Type: protocol.StreamTypeUni, Type: protocol.StreamTypeUni,
MaxStreamNum: 1, MaxStreamNum: 1,
})).To(Succeed()) })
str, err := m.OpenUniStream() str, err := m.OpenUniStream()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(str.StreamID()).To(Equal(ids.firstOutgoingUniStream)) Expect(str.StreamID()).To(Equal(ids.firstOutgoingUniStream))