@@ -5,7 +5,7 @@
5module Network.Wai.Handler.Warp.Run where
5module Network.Wai.Handler.Warp.Run where
7import Control.Concurrent (threadDelay, forkIOWithUnmask)
7import Control.Concurrent (threadDelay, forkIOWithUnmask)
8−import Control.Exception
8+import Control.Exception as E
9import Control.Monad (forever, when, unless, void)
9import Control.Monad (forever, when, unless, void)
10import Control.Monad.IO.Class (MonadIO, liftIO)
10import Control.Monad.IO.Class (MonadIO, liftIO)
11import Control.Monad.Trans.Class (lift)
11import Control.Monad.Trans.Class (lift)
@@ -27,7 +27,6 @@ import Network.Wai.Handler.Warp.Response
27import Network.Wai.Handler.Warp.Settings
27import Network.Wai.Handler.Warp.Settings
28import qualified Network.Wai.Handler.Warp.Timeout as T
28import qualified Network.Wai.Handler.Warp.Timeout as T
29import Network.Wai.Handler.Warp.Types
29import Network.Wai.Handler.Warp.Types
30−import Prelude hiding (catch)
32-- Sock.recv first tries to call recvfrom() optimistically.
31-- Sock.recv first tries to call recvfrom() optimistically.
33-- If EAGAIN returns, it polls incoming data with epoll/kqueue.
32-- If EAGAIN returns, it polls incoming data with epoll/kqueue.
@@ -212,7 +211,7 @@ runSettingsConnectionMaker set getConn app = do
212 serveConnection th set cleaner port app conn addr
211 serveConnection th set cleaner port app conn addr
214 -- FIXME: only IOEception is caught. What about other exceptions?
213 -- FIXME: only IOEception is caught. What about other exceptions?
215− getConnLoop = getConn `catch` \(e :: IOException) -> do
214+ getConnLoop = getConn `E.catch` \(e :: IOException) -> do
216 onE (toException e)
215 onE (toException e)
217 -- "resource exhausted (Too many open files)" may happen by accept().
216 -- "resource exhausted (Too many open files)" may happen by accept().
218 -- Wait a second hoping that resource will be available.
217 -- Wait a second hoping that resource will be available.
@@ -270,7 +269,7 @@ serveConnection timeoutHandle settings cleaner port app conn remoteHost' =
270 intercept fromClient' conn
269 intercept fromClient' conn
272respondOnException :: Settings -> Cleaner -> Connection -> SockAddr -> IO () -> IO ()
271respondOnException :: Settings -> Cleaner -> Connection -> SockAddr -> IO () -> IO ()
273−respondOnException settings cleaner conn remoteHost' io = io `catch` \e@(SomeException _) -> do
272+respondOnException settings cleaner conn remoteHost' io = io `E.catch` \e@(SomeException _) -> do
274 _ <- runResourceT $ sendResponse settings cleaner blankRequest conn internalError
273 _ <- runResourceT $ sendResponse settings cleaner blankRequest conn internalError
275 throwIO e
274 throwIO e