mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 05:07:36 +03:00
improve the 0-RTT rejection integration test
This commit is contained in:
parent
522cad0ba8
commit
d9c16ea5f1
1 changed files with 23 additions and 9 deletions
|
@ -584,20 +584,34 @@ var _ = Describe("0-RTT", func() {
|
||||||
)
|
)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
// The client remembers that it was allowed to open 2 uni-directional streams.
|
// The client remembers that it was allowed to open 2 uni-directional streams.
|
||||||
for i := 0; i < 2; i++ {
|
firstStr, err := sess.OpenUniStream()
|
||||||
str, err := sess.OpenUniStream()
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
written := make(chan struct{}, 2)
|
||||||
|
go func() {
|
||||||
|
defer GinkgoRecover()
|
||||||
|
defer func() { written <- struct{}{} }()
|
||||||
|
_, err := firstStr.Write([]byte("first flight"))
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
}()
|
||||||
|
secondStr, err := sess.OpenUniStream()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
go func() {
|
go func() {
|
||||||
defer GinkgoRecover()
|
defer GinkgoRecover()
|
||||||
_, err = str.Write([]byte("first flight"))
|
defer func() { written <- struct{}{} }()
|
||||||
|
_, err := secondStr.Write([]byte("first flight"))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
}()
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, err = sess.AcceptStream(ctx)
|
_, err = sess.AcceptStream(ctx)
|
||||||
Expect(err).To(Equal(quic.Err0RTTRejected))
|
Expect(err).To(MatchError(quic.Err0RTTRejected))
|
||||||
|
Eventually(written).Should(Receive())
|
||||||
|
Eventually(written).Should(Receive())
|
||||||
|
_, err = firstStr.Write([]byte("foobar"))
|
||||||
|
Expect(err).To(MatchError(quic.Err0RTTRejected))
|
||||||
|
_, err = sess.OpenUniStream()
|
||||||
|
Expect(err).To(MatchError(quic.Err0RTTRejected))
|
||||||
|
|
||||||
newSess := sess.NextSession()
|
newSess := sess.NextSession()
|
||||||
str, err := newSess.OpenUniStream()
|
str, err := newSess.OpenUniStream()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue