Skip to content

Commit 21ffadf

Browse files
document usage of StreamLimitReachedError when attempting to open streams (#95)
1 parent 4b8d31d commit 21ffadf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/docs/quic/streams.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ These functions return an error when the underlying QUIC connection is closed.
4646

4747
As described in [Flow Control for Streams]({{< relref "flowcontrol.md#stream-num" >}}), endpoints impose limits on how many streams a peer may open. The receiver may grant additional streams at any point in the connection (typically when existing streams are closed), but it means that at the time we want to open a new stream, we might not be able to do so.
4848

49-
`OpenStream` attempts to open a new bidirectional stream (`quic.Stream`), and it never blocks. If it's currently not possible to open a new stream, it returns a `net.Error` timeout error:
49+
`OpenStream` attempts to open a new bidirectional stream (`quic.Stream`), and it never blocks. If it's currently not possible to open a new stream, it returns a `quic.StreamLimitReachedError` error:
5050

5151
```go
5252
str, err := conn.OpenStream()
53-
if nerr, ok := err.(net.Error); ok && nerr.Timeout() {
53+
if errors.Is(err, &quic.StreamLimitReachedError{}) {
5454
// It's currently not possible to open another stream,
5555
// but it might be possible later, once the peer allowed us to do so.
5656
}

0 commit comments

Comments
 (0)