@@ -166,19 +166,23 @@ frameReceiver ctx mkreq recvN = loop 0 `E.catch` sendGoaway
166 when (ftyp `notElem` [FrameHeaders,FramePriority]) $
166 when (ftyp `notElem` [FrameHeaders,FramePriority]) $
167 E.throwIO $ ConnectionError ProtocolError "this frame is not allowed in an idel stream"
167 E.throwIO $ ConnectionError ProtocolError "this frame is not allowed in an idel stream"
168 csid <- readIORef clientStreamId
168 csid <- readIORef clientStreamId
169− when (streamId <= csid) $
169+ if streamId <= csid then do
170+ if ftyp == FramePriority then
171+ return Nothing -- will be ignored
170− E.throwIO $ ConnectionError ProtocolError "stream identifier must not decrease"
173+ E.throwIO $ ConnectionError ProtocolError "stream identifier must not decrease"
171− when (ftyp == FrameHeaders) $ do
175+ when (ftyp == FrameHeaders) $ do
172− writeIORef clientStreamId streamId
176+ writeIORef clientStreamId streamId
173− cnt <- readIORef concurrency
177+ cnt <- readIORef concurrency
174− -- Checking the limitation of concurrency
178+ -- Checking the limitation of concurrency
175− when (cnt >= maxConcurrency) $
179+ when (cnt >= maxConcurrency) $
176− E.throwIO $ StreamError RefusedStream streamId
180+ E.throwIO $ StreamError RefusedStream streamId
177− ws <- initialWindowSize <$> readIORef http2settings
181+ ws <- initialWindowSize <$> readIORef http2settings
178− newstrm <- newStream streamId (fromIntegral ws)
182+ newstrm <- newStream streamId (fromIntegral ws)
179− when (ftyp == FrameHeaders) $ opened ctx newstrm
183+ when (ftyp == FrameHeaders) $ opened ctx newstrm
180− insert streamTable streamId newstrm
184+ insert streamTable streamId newstrm
181− return $ Just newstrm
185+ return $ Just newstrm
183 consume = void . recvN
187 consume = void . recvN