diff --git a/session.go b/session.go index 39057ce6..3f0afdc3 100644 --- a/session.go +++ b/session.go @@ -567,10 +567,7 @@ func (s *session) sendPacket() error { // get WindowUpdate frames // this call triggers the flow controller to increase the flow control windows, if necessary - windowUpdateFrames, err := s.getWindowUpdateFrames() - if err != nil { - return err - } + windowUpdateFrames := s.getWindowUpdateFrames() for _, wuf := range windowUpdateFrames { controlFrames = append(controlFrames, wuf) } @@ -587,7 +584,7 @@ func (s *session) sendPacket() error { utils.Debugf("\tDequeueing handshake retransmission for packet 0x%x", retransmitPacket.PacketNumber) stopWaitingFrame := s.sentPacketHandler.GetStopWaitingFrame(true) var packet *packedPacket - packet, err = s.packer.RetransmitNonForwardSecurePacket(stopWaitingFrame, retransmitPacket) + packet, err := s.packer.RetransmitNonForwardSecurePacket(stopWaitingFrame, retransmitPacket) if err != nil { return err } @@ -609,7 +606,7 @@ func (s *session) sendPacket() error { // only retransmit WindowUpdates if the stream is not yet closed and the we haven't sent another WindowUpdate with a higher ByteOffset for the stream var currentOffset protocol.ByteCount f := frame.(*frames.WindowUpdateFrame) - currentOffset, err = s.flowControlManager.GetReceiveWindow(f.StreamID) + currentOffset, err := s.flowControlManager.GetReceiveWindow(f.StreamID) if err == nil && f.ByteOffset >= currentOffset { controlFrames = append(controlFrames, frame) } @@ -794,13 +791,13 @@ func (s *session) tryDecryptingQueuedPackets() { s.undecryptablePackets = s.undecryptablePackets[:0] } -func (s *session) getWindowUpdateFrames() ([]*frames.WindowUpdateFrame, error) { +func (s *session) getWindowUpdateFrames() []*frames.WindowUpdateFrame { updates := s.flowControlManager.GetWindowUpdates() res := make([]*frames.WindowUpdateFrame, len(updates)) for i, u := range updates { res[i] = &frames.WindowUpdateFrame{StreamID: u.StreamID, ByteOffset: u.Offset} } - return res, nil + return res } func (s *session) ackAlarmChanged(t time.Time) { diff --git a/session_test.go b/session_test.go index 419d825b..0db7cf2e 100644 --- a/session_test.go +++ b/session_test.go @@ -1438,8 +1438,7 @@ var _ = Describe("Session", func() { It("gets stream level window updates", func() { err := sess.flowControlManager.AddBytesRead(1, protocol.ReceiveStreamFlowControlWindow) Expect(err).NotTo(HaveOccurred()) - frames, err := sess.getWindowUpdateFrames() - Expect(err).NotTo(HaveOccurred()) + frames := sess.getWindowUpdateFrames() Expect(frames).To(HaveLen(1)) Expect(frames[0].StreamID).To(Equal(protocol.StreamID(1))) Expect(frames[0].ByteOffset).To(Equal(protocol.ReceiveStreamFlowControlWindow * 2)) @@ -1450,8 +1449,7 @@ var _ = Describe("Session", func() { Expect(err).NotTo(HaveOccurred()) err = sess.flowControlManager.AddBytesRead(5, protocol.ReceiveConnectionFlowControlWindow) Expect(err).NotTo(HaveOccurred()) - frames, err := sess.getWindowUpdateFrames() - Expect(err).NotTo(HaveOccurred()) + frames := sess.getWindowUpdateFrames() Expect(frames).To(HaveLen(1)) Expect(frames[0].StreamID).To(Equal(protocol.StreamID(0))) Expect(frames[0].ByteOffset).To(Equal(protocol.ReceiveConnectionFlowControlWindow * 2))