@@ -66,6 +66,15 @@ response Context{outputQ} mgr tconf th strm sq (s, h, strmbdy) = do
6666 flush = atomically $ writeTBQueue sq SFlush
6767 strmbdy push flush
6868
69+cleanupStream :: Context -> S.Settings -> Stream -> Maybe Request -> Maybe SomeException -> IO ()
70+cleanupStream ctx@Context{outputQ} set strm req me = do
71+ closed ctx strm Killed
72+ let frame = resetFrame InternalError (streamNumber strm)
73+ enqueue outputQ (OFrame frame) highestPriority
74+ case me of
75+ Nothing -> return ()
76+ Just e -> S.settingsOnException set req e
77+
6978data Break = Break deriving (Show, Typeable)
7079
7180instance Exception Break
@@ -117,12 +126,7 @@ worker ctx@Context{inputQ,outputQ} set tm app responder = do
117126 case m of
118127 Nothing -> return ()
119128 Just (strm,req) -> do
120− closed ctx strm Killed
121− let frame = resetFrame InternalError (streamNumber strm)
122− enqueue outputQ (OFrame frame) highestPriority
123− case me of
124− Nothing -> return ()
125− Just e -> S.settingsOnException set (Just req) e
129+ cleanupStream ctx set strm (Just req) me
126130 clearStreamInfo sinfo
127131
128132waiter :: TVar Sync -> TBQueue Sequence -> Stream -> PriorityTree Output -> IO ()