@@ -316,14 +316,17 @@ stream FrameRSTStream header bs _ _ strm = do
316316 closed strm cc
317317 return $ Closed cc -- will be written to streamState again
318318
319−stream FramePriority header bs Context{outputQ} s Stream{streamNumber,streamPrecedence} = do
319+stream FramePriority header bs Context{outputQ,priorityTreeSize} s Stream{streamNumber,streamPrecedence} = do
320320 PriorityFrame newpri <- guardIt $ decodePriorityFrame header bs
321321 checkPriority newpri streamNumber
322322 -- checkme: this should be tested
323323 oldpre <- readIORef streamPrecedence
324324 let !newpre = toPrecedence newpri
325325 writeIORef streamPrecedence newpre
326− if isIdle s then
326+ if isIdle s then do
327+ n <- atomicModifyIORef' priorityTreeSize (\x -> (x+1,x+1))
328+ -- fixme hard coding
329+ when (n >= 20) $ E.throwIO $ ConnectionError EnhanceYourCalm "too many idle priority frames"
327330 prepare outputQ streamNumber newpri
328331 else do
329332 mx <- delete outputQ streamNumber oldpre