introduce a StreamLimitReachedError for Connection.Open{Uni}Stream (#4579)

Using a concrete type is preferable to relying on interpreting the
return values from net.Error.Timeout and net.Error.Temporary, especially
since the latter has been deprecated since Go 1.18.
This commit is contained in:
Marten Seemann
2024-06-28 06:58:28 -07:00
committed by GitHub
parent 7379f1fd5e
commit b52c33939d
5 changed files with 35 additions and 23 deletions

View File

@@ -361,8 +361,7 @@ var _ = Describe("Streams Map (outgoing)", func() {
Expect(bf.StreamLimit).To(BeEquivalentTo(6))
})
_, err := m.OpenStream()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal(errTooManyOpenStreams.Error()))
Expect(err).To(MatchError(&StreamLimitReachedError{}))
})
It("only sends one STREAMS_BLOCKED frame for one stream ID", func() {
@@ -452,8 +451,7 @@ var _ = Describe("Streams Map (outgoing)", func() {
}
str, err := m.OpenStream()
if limit <= n {
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal(errTooManyOpenStreams.Error()))
Expect(err).To(MatchError(&StreamLimitReachedError{}))
} else {
Expect(str.num).To(Equal(protocol.StreamNum(n + 1)))
}