on master help sign in
Ignoring all exceptions and just closing connection
6a02c14Michael Snoyman
Network/Wai/Handler/Warp.hs+5−2
@@ -20,6 +20,7 @@ module Network.Wai.Handler.Warp
20 , parseRequest
20 , parseRequest
21 ) where
21 ) where
22
22
23+import Prelude hiding (catch)
23import Network.Wai
24import Network.Wai
24import qualified System.IO
25import qualified System.IO
25
26
@@ -34,7 +35,7 @@ import Network.Socket
34 ( accept
35 ( accept
35 )
36 )
36import qualified Network.Socket.ByteString as Sock
37import qualified Network.Socket.ByteString as Sock
37−import Control.Exception (bracket, finally, Exception)
38+import Control.Exception (bracket, finally, Exception, SomeException, catch)
38import System.IO (Handle, hClose, hFlush)
39import System.IO (Handle, hClose, hFlush)
39import System.IO.Error (isEOFError, ioeGetHandle)
40import System.IO.Error (isEOFError, ioeGetHandle)
40import Control.Concurrent (forkIO)
41import Control.Concurrent (forkIO)
@@ -79,8 +80,10 @@ serveConnection port app conn remoteHost' = do
79 (finally
80 (finally
80 (E.run_ $ fromClient $$ serveConnection')
81 (E.run_ $ fromClient $$ serveConnection')
81 (sClose conn))
82 (sClose conn))
82− undefined
83+ ignoreAll
83 where
84 where
85+ ignoreAll :: SomeException -> IO ()
86+ ignoreAll _ = return ()
84 fromClient = enumSocket 4096 conn
87 fromClient = enumSocket 4096 conn
85 serveConnection' = do
88 serveConnection' = do
86 (enumeratee, env) <- parseRequest port remoteHost'
89 (enumeratee, env) <- parseRequest port remoteHost'