Skip to content

Commit

Permalink
Merge pull request #2101 from lucas-clemente/stop-sending-error-code
Browse files Browse the repository at this point in the history
copy error code from the STOP_SENDING frame to the RESET_STREAM frame
  • Loading branch information
marten-seemann committed Aug 31, 2019
2 parents f1d14ec + 2836442 commit e35d845
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion send_stream.go
Expand Up @@ -296,7 +296,7 @@ func (s *sendStream) handleStopSendingFrameImpl(frame *wire.StopSendingFrame) bo
errorCode: frame.ErrorCode,
error: fmt.Errorf("Stream %d was reset with error code %d", s.streamID, frame.ErrorCode),
}
return s.cancelWriteImpl(errorCodeStopping, writeErr)
return s.cancelWriteImpl(frame.ErrorCode, writeErr)
}

func (s *sendStream) Context() context.Context {
Expand Down
4 changes: 2 additions & 2 deletions send_stream_test.go
Expand Up @@ -609,10 +609,10 @@ var _ = Describe("Send Stream", func() {
})

Context("receiving STOP_SENDING frames", func() {
It("queues a RESET_STREAM frames with error code Stopping", func() {
It("queues a RESET_STREAM frames, and copies the error code from the STOP_SENDING frame", func() {
mockSender.EXPECT().queueControlFrame(&wire.ResetStreamFrame{
StreamID: streamID,
ErrorCode: errorCodeStopping,
ErrorCode: 101,
})
mockSender.EXPECT().onStreamCompleted(streamID)
str.handleStopSendingFrame(&wire.StopSendingFrame{
Expand Down
2 changes: 0 additions & 2 deletions stream.go
Expand Up @@ -10,8 +10,6 @@ import (
"github.com/lucas-clemente/quic-go/internal/wire"
)

const errorCodeStopping protocol.ApplicationErrorCode = 0

// The streamSender is notified by the stream about various events.
type streamSender interface {
queueControlFrame(wire.Frame)
Expand Down

0 comments on commit e35d845

Please sign in to comment.