@@ -21,6 +21,7 @@ import Network.Sendfile
2121import Network.Socket (accept, SockAddr)
2222import qualified Network.Socket.ByteString as Sock
2323import Network.Wai
24+import qualified Network.Wai.Handler.Warp.FdCache as F
2425import Network.Wai.Handler.Warp.Recv
2526import Network.Wai.Handler.Warp.Request
2627import Network.Wai.Handler.Warp.Response
@@ -37,11 +38,6 @@ import System.Posix.IO (FdOption(CloseOnExec), setFdOption)
3738import Network.Socket (fdSocket)
3839#endif
3940
40−#if SENDFILEFD
41−import Control.Applicative
42−import qualified Network.Wai.Handler.Warp.FdCache as F
43−#endif
44−
4541-- FIXME come up with good values here
4642bytesPerRead :: Int
4743bytesPerRead = 4096
@@ -136,12 +132,7 @@ runSettingsConnection set getConn app = runSettingsConnectionMaker set getConnMa
136132-- which will return 'Connection'.
137133runSettingsConnectionMaker :: Settings -> IO (IO Connection, SockAddr) -> Application -> IO ()
138134runSettingsConnectionMaker set getConnMaker app = do
139−#if SENDFILEFD
140− let duration = settingsFdCacheDuration set
141− fc <- case duration of
142− 0 -> return Nothing
143− _ -> Just <$> F.initialize (duration * 1000000)
144−#endif
135+ fc <- F.initialize (settingsFdCacheDuration set * 1000000)
145136 settingsBeforeMainLoop set
146137
147138 -- Note that there is a thorough discussion of the exception safety of the
@@ -192,11 +183,7 @@ runSettingsConnectionMaker set getConnMaker app = do
192183 -- We need to register a timeout handler for this thread, and
193184 -- cancel that handler as soon as we exit.
194185 bracket (T.registerKillThread tm) T.cancel $ \th ->
195−#if SENDFILEFD
196186 let cleaner = Cleaner th fc
197−#else
198− let cleaner = Cleaner th
199−#endif
200187 -- We now have fully registered a connection close handler
201188 -- in the case of all exceptions, so it is safe to one
202189 -- again allow async exceptions.