send stream counts, not stream IDs, in the transport parameters

This commit is contained in:
Marten Seemann 2018-03-15 09:18:36 +01:00
parent 1fffb88553
commit b40942d39e
10 changed files with 83 additions and 74 deletions

View file

@ -3,6 +3,7 @@ package quic
import (
"errors"
"fmt"
"math"
"github.com/golang/mock/gomock"
"github.com/lucas-clemente/quic-go/internal/flowcontrol"
@ -63,8 +64,8 @@ var _ = Describe("Streams Map (for IETF QUIC)", func() {
allowUnlimitedStreams := func() {
m.UpdateLimits(&handshake.TransportParameters{
MaxBidiStreamID: 0xffffffff,
MaxUniStreamID: 0xffffffff,
MaxBidiStreams: math.MaxUint16,
MaxUniStreams: math.MaxUint16,
})
}
@ -266,26 +267,28 @@ var _ = Describe("Streams Map (for IETF QUIC)", func() {
mockSender.EXPECT().queueControlFrame(gomock.Any())
})
It("processes the parameter for outgoing bidirectional streams", func() {
It("processes the parameter for outgoing streams, as a server", func() {
m.perspective = protocol.PerspectiveServer
_, err := m.OpenStream()
Expect(err).To(MatchError(qerr.TooManyOpenStreams))
m.UpdateLimits(&handshake.TransportParameters{
MaxBidiStreamID: ids.firstOutgoingBidiStream,
MaxBidiStreams: 5,
MaxUniStreams: 5,
})
str, err := m.OpenStream()
Expect(err).ToNot(HaveOccurred())
Expect(str.StreamID()).To(Equal(ids.firstOutgoingBidiStream))
Expect(m.outgoingBidiStreams.maxStream).To(Equal(protocol.StreamID(17)))
Expect(m.outgoingUniStreams.maxStream).To(Equal(protocol.StreamID(19)))
})
It("processes the parameter for outgoing bidirectional streams", func() {
It("processes the parameter for outgoing streams, as a client", func() {
m.perspective = protocol.PerspectiveClient
_, err := m.OpenUniStream()
Expect(err).To(MatchError(qerr.TooManyOpenStreams))
m.UpdateLimits(&handshake.TransportParameters{
MaxUniStreamID: ids.firstOutgoingUniStream,
MaxBidiStreams: 5,
MaxUniStreams: 5,
})
str, err := m.OpenUniStream()
Expect(err).ToNot(HaveOccurred())
Expect(str.StreamID()).To(Equal(ids.firstOutgoingUniStream))
Expect(m.outgoingBidiStreams.maxStream).To(Equal(protocol.StreamID(20)))
Expect(m.outgoingUniStreams.maxStream).To(Equal(protocol.StreamID(18)))
})
})