| 153 | } |
| 154 | |
| 155 | func (q *quicConnection) acceptStream(ctx context.Context) error { |
| 156 | for { |
| 157 | quicStream, err := q.conn.AcceptStream(ctx) |
| 158 | if err != nil { |
| 159 | // context.Canceled is usually a user ctrl+c. We don't want to log an error here as it's intentional. |
| 160 | if errors.Is(err, context.Canceled) || q.controlStreamHandler.IsStopped() { |
| 161 | return nil |
| 162 | } |
| 163 | return fmt.Errorf("failed to accept QUIC stream: %w", err) |
| 164 | } |
| 165 | go q.runStream(quicStream) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | func (q *quicConnection) runStream(quicStream quic.Stream) { |
| 170 | ctx := quicStream.Context() |