on master help sign in
using FdCache for BSD variants.
commit1c461e41909099498224d36a82284520c1c36034 authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 11 Jun 2015, 15:41 (11 years ago) parent72032ec
4 files changed+8−8
warp/Network/Wai/Handler/Warp/FdCache.hs+1−1 warp/Network/Wai/Handler/Warp/Response.hs+4−4 warp/Network/Wai/Handler/Warp/Types.hs+2−2 warp/test/FdCacheSpec.hs+1−1
warp/Network/Wai/Handler/Warp/FdCache.hs+1−1
@@ -2,7 +2,7 @@
22
33-- | File descriptor cache to avoid locks in kernel.
44
5−#ifndef SENDFILEFD
5+#ifdef WINDOWS
66module Network.Wai.Handler.Warp.FdCache (
77 withFdCache
88 , MutableFdCache
warp/Network/Wai/Handler/Warp/Response.hs+4−4
@@ -244,16 +244,16 @@ sendRsp conn mfdc ver s0 hs0 (RspFile path mPart mRange isHead hook) = do
244244 sendRsp conn mfdc ver s hs1 (RspBuilder mempty False)
245245 else do
246246 lheader <- composeHeader ver s hs1
247−#ifdef SENDFILEFD
247+#ifdef WINDOWS
248+ let fid = FileId path Nothing
249+ hook' = hook
250+#else
248251 (mfd, hook') <- case mfdc of
249252 Nothing -> return (Nothing, hook)
250253 Just fdc -> do
251254 (fd, fresher) <- F.getFd fdc path
252255 return (Just fd, hook >> fresher)
253256 let fid = FileId path mfd
254−#else
255− let fid = FileId path Nothing
256− hook' = hook
257257#endif
258258 connSendFile conn fid beg len hook' [lheader]
259259 | otherwise -> do
warp/Network/Wai/Handler/Warp/Types.hs+2−2
@@ -16,7 +16,7 @@ import qualified Network.Wai.Handler.Warp.Date as D
1616import qualified Network.Wai.Handler.Warp.FdCache as F
1717import qualified Network.Wai.Handler.Warp.Timeout as T
1818
19−#ifdef SENDFILEFD
19+#ifndef WINDOWS
2020import System.Posix.Types (Fd)
2121#endif
2222
@@ -67,7 +67,7 @@ instance Exception InvalidRequest
6767
6868----------------------------------------------------------------
6969
70−#ifndef SENDFILEFD
70+#ifdef WINDOWS
7171type Fd = ()
7272#endif
7373
warp/test/FdCacheSpec.hs+1−1
@@ -3,7 +3,7 @@
33module FdCacheSpec where
44
55import Test.Hspec
6−#ifdef SENDFILEFD
6+#ifndef WINDOWS
77import Data.IORef
88import Network.Wai.Handler.Warp.FdCache
99import System.Posix.IO (fdRead)