@@ -154,8 +154,17 @@ frameReceiver ctx mkreq recvN = loop `E.catch` sendGoaway
154154 else
155155 writeIORef currentStreamId streamId
156156 cnt <- readIORef concurrency
157− when (cnt >= recommendedConcurrency) $
158− E.throwIO $ ConnectionError RefusedStream "over max concurrency"
157+ when (cnt >= recommendedConcurrency) $ do
158+ -- Record that the stream is closed, rather than
159+ -- idle, so that receiving frames on it is only a
160+ -- stream error.
161+ consume payloadLength
162+ strm <- newStream streamId 0
163+ writeIORef (streamState strm) $ Closed $
164+ ResetByMe $ E.toException $
165+ StreamError RefusedStream streamId
166+ insert streamTable streamId strm
167+ E.throwIO $ StreamError RefusedStream streamId
159168 ws <- initialWindowSize <$> readIORef http2settings
160169 newstrm <- newStream streamId (fromIntegral ws)
161170 when (ftyp == FrameHeaders) $ opened ctx newstrm