mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
add a context to Session.Accept{Uni}Stream
This commit is contained in:
parent
f74082b2fb
commit
5550ba2c3b
28 changed files with 140 additions and 105 deletions
|
@ -1,6 +1,7 @@
|
|||
package quic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
|
@ -121,7 +122,7 @@ var _ = Describe("Streams Map", func() {
|
|||
It("accepts bidirectional streams", func() {
|
||||
_, err := m.GetOrOpenReceiveStream(ids.firstIncomingBidiStream)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
str, err := m.AcceptStream()
|
||||
str, err := m.AcceptStream(context.Background())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(str).To(BeAssignableToTypeOf(&stream{}))
|
||||
Expect(str.StreamID()).To(Equal(ids.firstIncomingBidiStream))
|
||||
|
@ -130,7 +131,7 @@ var _ = Describe("Streams Map", func() {
|
|||
It("accepts unidirectional streams", func() {
|
||||
_, err := m.GetOrOpenReceiveStream(ids.firstIncomingUniStream)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
str, err := m.AcceptUniStream()
|
||||
str, err := m.AcceptUniStream(context.Background())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(str).To(BeAssignableToTypeOf(&receiveStream{}))
|
||||
Expect(str.StreamID()).To(Equal(ids.firstIncomingUniStream))
|
||||
|
@ -170,7 +171,7 @@ var _ = Describe("Streams Map", func() {
|
|||
_, err := m.GetOrOpenReceiveStream(id)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(m.DeleteStream(id)).To(Succeed())
|
||||
str, err := m.AcceptStream()
|
||||
str, err := m.AcceptStream(context.Background())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(str).ToNot(BeNil())
|
||||
Expect(str.StreamID()).To(Equal(id))
|
||||
|
@ -203,7 +204,7 @@ var _ = Describe("Streams Map", func() {
|
|||
_, err := m.GetOrOpenReceiveStream(id)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(m.DeleteStream(id)).To(Succeed())
|
||||
str, err := m.AcceptUniStream()
|
||||
str, err := m.AcceptUniStream(context.Background())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(str).ToNot(BeNil())
|
||||
Expect(str.StreamID()).To(Equal(id))
|
||||
|
@ -393,7 +394,7 @@ var _ = Describe("Streams Map", func() {
|
|||
It("sends a MAX_STREAMS frame for bidirectional streams", func() {
|
||||
_, err := m.GetOrOpenReceiveStream(ids.firstIncomingBidiStream)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = m.AcceptStream()
|
||||
_, err = m.AcceptStream(context.Background())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mockSender.EXPECT().queueControlFrame(&wire.MaxStreamsFrame{
|
||||
Type: protocol.StreamTypeBidi,
|
||||
|
@ -405,7 +406,7 @@ var _ = Describe("Streams Map", func() {
|
|||
It("sends a MAX_STREAMS frame for unidirectional streams", func() {
|
||||
_, err := m.GetOrOpenReceiveStream(ids.firstIncomingUniStream)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = m.AcceptUniStream()
|
||||
_, err = m.AcceptUniStream(context.Background())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mockSender.EXPECT().queueControlFrame(&wire.MaxStreamsFrame{
|
||||
Type: protocol.StreamTypeUni,
|
||||
|
@ -424,10 +425,10 @@ var _ = Describe("Streams Map", func() {
|
|||
_, err = m.OpenUniStream()
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(Equal(testErr.Error()))
|
||||
_, err = m.AcceptStream()
|
||||
_, err = m.AcceptStream(context.Background())
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(Equal(testErr.Error()))
|
||||
_, err = m.AcceptUniStream()
|
||||
_, err = m.AcceptUniStream(context.Background())
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(Equal(testErr.Error()))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue