Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conduit 0.5 support #7

Merged
merged 1 commit into from Jul 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions Network/Sendfile/Fallback.hs
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
module Network.Sendfile.Fallback ( module Network.Sendfile.Fallback (
sendfile sendfile
, sendfileWithHeader , sendfileWithHeader
Expand Down Expand Up @@ -26,13 +27,17 @@ sendfile sock path (PartOfFile off len) hook =


-- See sinkHandle. -- See sinkHandle.
sinkSocket :: MonadIO m => Socket -> IO () -> Sink ByteString m () 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 sinkSocket s hook = NeedInput push close
where where
push bs = flip PipeM (return ()) $ do push bs = flip PipeM (return ()) $ do
liftIO (SB.sendAll s bs) liftIO (SB.sendAll s bs)
liftIO hook liftIO hook
return (NeedInput push close) return (NeedInput push close)
close = return () close = return ()
#endif


-- | -- |
-- Sendfile emulation using conduit. -- Sendfile emulation using conduit.
Expand Down
2 changes: 1 addition & 1 deletion simple-sendfile.cabal
Expand Up @@ -41,7 +41,7 @@ Library
else else
Other-Modules: Network.Sendfile.Fallback Other-Modules: Network.Sendfile.Fallback
Build-Depends: bytestring >= 0.9 && < 0.10 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 , transformers >= 0.2.2 && < 0.4


Test-Suite spec Test-Suite spec
Expand Down