Skip to content

Commit

Permalink
using withHandleKillThread in Warp
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Nov 21, 2024
1 parent f746267 commit 77e04de
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions warp/Network/Wai/Handler/Warp/HTTP2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ http2server label settings ii transport addr app h2req0 aux0 response = do
logResponse req st msiz
mapM_ (logPushPromise req) pps
Left e
-- killed by the local worker manager
| Just E.ThreadKilled <- E.fromException e -> return ()
-- killed by the local timeout manager
| Just T.TimeoutThread <- E.fromException e -> return ()
| isAsyncException e -> E.throwIO e
| otherwise -> do
S.settingsOnException settings (Just req) e
Expand Down
5 changes: 1 addition & 4 deletions warp/Network/Wai/Handler/Warp/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ fork set mkConn addr app counter ii = settingsFork set $ \unmask -> do

-- We need to register a timeout handler for this thread, and
-- cancel that handler as soon as we exit.
serve unmask (conn, transport) = E.bracket register cancel $ \th -> do
serve unmask (conn, transport) = T.withHandleKillThread (timeoutManager ii) (return ()) $ \th -> do
-- We now have fully registered a connection close handler in
-- the case of all exceptions, so it is safe to once again
-- allow async exceptions.
Expand All @@ -368,9 +368,6 @@ fork set mkConn addr app counter ii = settingsFork set $ \unmask -> do
-- Actually serve this connection. bracket with closeConn
-- above ensures the connection is closed.
when goingon $ serveConnection conn ii th addr transport set app
where
register = T.registerKillThread (timeoutManager ii) (return ())
cancel = T.cancel

onOpen adr = increase counter >> settingsOnOpen set adr
onClose adr _ = decrease counter >> settingsOnClose set adr
Expand Down
2 changes: 1 addition & 1 deletion warp/warp.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ library
stm >=2.3,
streaming-commons >=0.1.10,
text,
time-manager >=0.1 && <0.2,
time-manager >=0.1.3 && <0.2,
vault >=0.3,
wai >=3.2.4 && <3.3,
word8
Expand Down

0 comments on commit 77e04de

Please sign in to comment.