Permalink
Browse files

conduit 0.5 support

  • Loading branch information...
snoyberg committed Jul 14, 2012
1 parent c6b44cc commit be013207d3b3c7ef0f893ab675a885bfa14ba975
Showing with 6 additions and 1 deletion.
  1. +5 −0 Network/Sendfile/Fallback.hs
  2. +1 −1 simple-sendfile.cabal
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
module Network.Sendfile.Fallback (
sendfile
, sendfileWithHeader
@@ -26,13 +27,17 @@ sendfile sock path (PartOfFile off len) hook =
-- See sinkHandle.
sinkSocket :: MonadIO m => Socket -> IO () -> Sink ByteString m ()
+#if MIN_VERSION_conduit(0,5,0)
+sinkSocket s hook = awaitForever $ \bs -> liftIO $ SB.sendAll s bs >> hook
+#else
sinkSocket s hook = NeedInput push close
where
push bs = flip PipeM (return ()) $ do
liftIO (SB.sendAll s bs)
liftIO hook
return (NeedInput push close)
close = return ()
+#endif
-- |
-- Sendfile emulation using conduit.
View
@@ -41,7 +41,7 @@ Library
else
Other-Modules: Network.Sendfile.Fallback
Build-Depends: bytestring >= 0.9 && < 0.10
- , conduit >= 0.4.1 && < 0.5
+ , conduit >= 0.4.1 && < 0.6
, transformers >= 0.2.2 && < 0.4
Test-Suite spec

0 comments on commit be01320

Please sign in to comment.