mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
fix handling of RESET_STREAM frames after receiving the final offset
This commit is contained in:
parent
63585d1b5e
commit
dc66c8a4e4
2 changed files with 16 additions and 1 deletions
|
@ -269,6 +269,7 @@ func (s *receiveStream) handleResetStreamFrameImpl(frame *wire.ResetStreamFrame)
|
||||||
if err := s.flowController.UpdateHighestReceived(frame.ByteOffset, true); err != nil {
|
if err := s.flowController.UpdateHighestReceived(frame.ByteOffset, true); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
newlyRcvdFinalOffset := s.finalOffset == protocol.MaxByteCount
|
||||||
s.finalOffset = frame.ByteOffset
|
s.finalOffset = frame.ByteOffset
|
||||||
|
|
||||||
// ignore duplicate RESET_STREAM frames for this stream (after checking their final offset)
|
// ignore duplicate RESET_STREAM frames for this stream (after checking their final offset)
|
||||||
|
@ -281,7 +282,7 @@ func (s *receiveStream) handleResetStreamFrameImpl(frame *wire.ResetStreamFrame)
|
||||||
error: fmt.Errorf("stream %d was reset with error code %d", s.streamID, frame.ErrorCode),
|
error: fmt.Errorf("stream %d was reset with error code %d", s.streamID, frame.ErrorCode),
|
||||||
}
|
}
|
||||||
s.signalRead()
|
s.signalRead()
|
||||||
return true, nil
|
return newlyRcvdFinalOffset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *receiveStream) CloseRemote(offset protocol.ByteCount) {
|
func (s *receiveStream) CloseRemote(offset protocol.ByteCount) {
|
||||||
|
|
|
@ -616,6 +616,20 @@ var _ = Describe("Receive Stream", func() {
|
||||||
Expect(str.handleResetStreamFrame(rst)).To(Succeed())
|
Expect(str.handleResetStreamFrame(rst)).To(Succeed())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("doesn't call onStreamCompleted again when the final offset was already received via FinBit", func() {
|
||||||
|
mockSender.EXPECT().queueControlFrame(gomock.Any())
|
||||||
|
str.CancelRead(1234)
|
||||||
|
mockSender.EXPECT().onStreamCompleted(streamID)
|
||||||
|
mockFC.EXPECT().Abandon()
|
||||||
|
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(42), true).Times(2)
|
||||||
|
Expect(str.handleStreamFrame(&wire.StreamFrame{
|
||||||
|
StreamID: streamID,
|
||||||
|
Offset: rst.ByteOffset,
|
||||||
|
FinBit: true,
|
||||||
|
})).To(Succeed())
|
||||||
|
Expect(str.handleResetStreamFrame(rst)).To(Succeed())
|
||||||
|
})
|
||||||
|
|
||||||
It("doesn't do anyting when it was closed for shutdown", func() {
|
It("doesn't do anyting when it was closed for shutdown", func() {
|
||||||
str.closeForShutdown(nil)
|
str.closeForShutdown(nil)
|
||||||
err := str.handleResetStreamFrame(rst)
|
err := str.handleResetStreamFrame(rst)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue