mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
allow 0-RTT when the server's connection receive limit is increased
This commit is contained in:
parent
6c3876d6b3
commit
31ac5ca60d
4 changed files with 81 additions and 68 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/lucas-clemente/quic-go/logging"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/extensions/table"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
|
@ -550,22 +551,26 @@ var _ = Describe("0-RTT", func() {
|
|||
Expect(get0RTTPackets(tracer.getRcvdPackets())).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("doesn't reject 0-RTT when the server's transport stream flow control limit increased", func() {
|
||||
tlsConf, clientConf := dialAndReceiveSessionTicket(getQuicConfig(&quic.Config{
|
||||
InitialStreamReceiveWindow: 3,
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
}))
|
||||
|
||||
DescribeTable("flow control limits",
|
||||
func(addFlowControlLimit func(*quic.Config, uint64)) {
|
||||
tracer := newRcvdPacketTracer()
|
||||
firstConf := getQuicConfig(&quic.Config{
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
})
|
||||
addFlowControlLimit(firstConf, 3)
|
||||
tlsConf, clientConf := dialAndReceiveSessionTicket(firstConf)
|
||||
|
||||
secondConf := getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
})
|
||||
addFlowControlLimit(secondConf, 100)
|
||||
ln, err := quic.ListenAddrEarly(
|
||||
"localhost:0",
|
||||
tlsConf,
|
||||
getQuicConfig(&quic.Config{
|
||||
Versions: []protocol.VersionNumber{version},
|
||||
AcceptToken: func(_ net.Addr, _ *quic.Token) bool { return true },
|
||||
InitialStreamReceiveWindow: 100,
|
||||
Tracer: newTracer(func() logging.ConnectionTracer { return tracer }),
|
||||
}),
|
||||
secondConf,
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer ln.Close()
|
||||
|
@ -620,7 +625,10 @@ var _ = Describe("0-RTT", func() {
|
|||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
Entry("doesn't reject 0-RTT when the server's transport stream flow control limit increased", func(c *quic.Config, limit uint64) { c.InitialStreamReceiveWindow = limit }),
|
||||
Entry("doesn't reject 0-RTT when the server's transport connection flow control limit increased", func(c *quic.Config, limit uint64) { c.InitialConnectionReceiveWindow = limit }),
|
||||
)
|
||||
|
||||
It("correctly deals with 0-RTT rejections", func() {
|
||||
tlsConf, clientConf := dialAndReceiveSessionTicket(nil)
|
||||
|
|
|
@ -776,7 +776,7 @@ var _ = Describe("Crypto Setup TLS", func() {
|
|||
Expect(client.ConnectionState().Used0RTT).To(BeTrue())
|
||||
})
|
||||
|
||||
It("rejects 0-RTT, whent the transport parameters changed", func() {
|
||||
It("rejects 0-RTT, when the transport parameters changed", func() {
|
||||
csc := mocktls.NewMockClientSessionCache(mockCtrl)
|
||||
var state *tls.ClientSessionState
|
||||
receivedSessionTicket := make(chan struct{})
|
||||
|
@ -810,7 +810,7 @@ var _ = Describe("Crypto Setup TLS", func() {
|
|||
clientHelloWrittenChan, client, clientErr, server, serverErr = handshakeWithTLSConf(
|
||||
clientConf, serverConf,
|
||||
clientRTTStats, &utils.RTTStats{},
|
||||
&wire.TransportParameters{}, &wire.TransportParameters{InitialMaxData: initialMaxData + 1},
|
||||
&wire.TransportParameters{}, &wire.TransportParameters{InitialMaxData: initialMaxData - 1},
|
||||
true,
|
||||
)
|
||||
Expect(clientErr).ToNot(HaveOccurred())
|
||||
|
|
|
@ -528,11 +528,16 @@ var _ = Describe("Transport Parameters", func() {
|
|||
Expect(p.ValidFor0RTT(saved)).To(BeTrue())
|
||||
})
|
||||
|
||||
It("rejects the parameters if the InitialMaxData changed", func() {
|
||||
p.InitialMaxData = 0
|
||||
It("rejects the parameters if the InitialMaxData was reduced", func() {
|
||||
p.InitialMaxData = saved.InitialMaxData - 1
|
||||
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
|
||||
})
|
||||
|
||||
It("doesn't reject the parameters if the InitialMaxData was increased", func() {
|
||||
p.InitialMaxData = saved.InitialMaxData + 1
|
||||
Expect(p.ValidFor0RTT(saved)).To(BeTrue())
|
||||
})
|
||||
|
||||
It("rejects the parameters if the MaxBidiStreamNum was reduced", func() {
|
||||
p.MaxBidiStreamNum = saved.MaxBidiStreamNum - 1
|
||||
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
|
||||
|
|
|
@ -444,7 +444,7 @@ func (p *TransportParameters) ValidFor0RTT(saved *TransportParameters) bool {
|
|||
return p.InitialMaxStreamDataBidiLocal >= saved.InitialMaxStreamDataBidiLocal &&
|
||||
p.InitialMaxStreamDataBidiRemote >= saved.InitialMaxStreamDataBidiRemote &&
|
||||
p.InitialMaxStreamDataUni >= saved.InitialMaxStreamDataUni &&
|
||||
p.InitialMaxData == saved.InitialMaxData &&
|
||||
p.InitialMaxData >= saved.InitialMaxData &&
|
||||
p.MaxBidiStreamNum >= saved.MaxBidiStreamNum &&
|
||||
p.MaxUniStreamNum >= saved.MaxUniStreamNum &&
|
||||
p.ActiveConnectionIDLimit == saved.ActiveConnectionIDLimit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue