simple-sendfile 0.2.1 → 0.2.2
raw patch · 2 files changed
+16/−11 lines, 2 filesdep ~bytestringdep ~conduitdep ~transformers
Dependency ranges changed: bytestring, conduit, transformers
Files
- Network/Sendfile/Fallback.hs +12/−9
- simple-sendfile.cabal +4/−2
Network/Sendfile/Fallback.hs view
@@ -1,6 +1,7 @@ module Network.Sendfile.Fallback (sendfile) where -import Control.Monad.IO.Class+import Control.Monad.Trans.Class (lift)+import Control.Monad.IO.Class (liftIO) import Data.ByteString (ByteString) import Data.Conduit import Data.Conduit.Binary as EB@@ -19,12 +20,14 @@ sendfile s fp (PartOfFile off len) hook = runResourceT $ EB.sourceFileRange fp (Just off) (Just len) $$ sinkSocket s hook -sinkSocket :: Socket -> IO () -> Sink ByteString IO ()-sinkSocket s hook =- SinkData push close+sinkSocket :: MonadResource m => Socket -> IO () -> Sink ByteString m ()+sinkSocket s hook = NeedInput push close where- push bs = do- liftIO $ SB.sendAll s bs- liftIO hook- return (Processing push close)- close = return ()+ push bs = PipeM sendAndHook close'+ where+ sendAndHook = do+ liftIO (SB.sendAll s bs)+ liftIO hook+ return (NeedInput push close)+ close' = return ()+ close = lift close'
simple-sendfile.cabal view
@@ -1,5 +1,5 @@ Name: simple-sendfile-Version: 0.2.1+Version: 0.2.2 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3@@ -37,7 +37,9 @@ Build-Depends: unix else Other-Modules: Network.Sendfile.Fallback- Build-Depends: bytestring, conduit, transformers+ Build-Depends: bytestring >= 0.9 && < 0.10+ , conduit >= 0.4 && < 0.5+ , transformers >= 0.2.2 && < 0.4 Source-Repository head Type: git