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.
func (m *MockStreamManager) HandleMaxStreamsFrame(arg0 *wire.MaxStreamsFrame) error {
func (m *MockStreamManager) HandleMaxStreamsFrame(arg0 *wire.MaxStreamsFrame) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HandleMaxStreamsFrame", arg0)
ret0, _ := ret[0].(error)
return ret0
m.ctrl.Call(m, "HandleMaxStreamsFrame", arg0)
}
// HandleMaxStreamsFrame indicates an expected call of HandleMaxStreamsFrame.

View file

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

View file

@ -247,16 +247,7 @@ var _ = Describe("Session", func() {
MaxStreamNum: 10,
}
streamManager.EXPECT().HandleMaxStreamsFrame(f)
err := 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))
sess.handleMaxStreamsFrame(f)
})
})

View file

@ -212,14 +212,13 @@ func (m *streamsMap) getOrOpenSendStream(id protocol.StreamID) (sendStreamI, err
panic("")
}
func (m *streamsMap) HandleMaxStreamsFrame(f *wire.MaxStreamsFrame) error {
func (m *streamsMap) HandleMaxStreamsFrame(f *wire.MaxStreamsFrame) {
switch f.Type {
case protocol.StreamTypeUni:
m.outgoingUniStreams.SetMaxStream(f.MaxStreamNum)
case protocol.StreamTypeBidi:
m.outgoingBidiStreams.SetMaxStream(f.MaxStreamNum)
}
return nil
}
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() {
_, err := m.OpenStream()
expectTooManyStreamsError(err)
Expect(m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{
m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{
Type: protocol.StreamTypeBidi,
MaxStreamNum: 1,
})).To(Succeed())
})
str, err := m.OpenStream()
Expect(err).ToNot(HaveOccurred())
Expect(str.StreamID()).To(Equal(ids.firstOutgoingBidiStream))
@ -377,10 +377,10 @@ var _ = Describe("Streams Map", func() {
It("processes IDs for outgoing unidirectional streams", func() {
_, err := m.OpenUniStream()
expectTooManyStreamsError(err)
Expect(m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{
m.HandleMaxStreamsFrame(&wire.MaxStreamsFrame{
Type: protocol.StreamTypeUni,
MaxStreamNum: 1,
})).To(Succeed())
})
str, err := m.OpenUniStream()
Expect(err).ToNot(HaveOccurred())
Expect(str.StreamID()).To(Equal(ids.firstOutgoingUniStream))