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

@@ -60,7 +60,7 @@ func (m *outgoingStreamsMap[T]) OpenStream() (T, error) {
// if there are OpenStreamSync calls waiting, return an error here
if len(m.openQueue) > 0 || m.nextStream > m.maxStream {
m.maybeSendBlockedFrame()
return *new(T), streamOpenErr{errTooManyOpenStreams}
return *new(T), streamOpenErr{&StreamLimitReachedError{}}
}
return m.openStream(), nil
}