sendfile 0.7.9 → 0.7.10
raw patch · 3 files changed
+18/−4 lines, 3 filesdep ~basedep ~network
Dependency ranges changed: base, network
Files
- sendfile.cabal +5/−4
- src/Network/Socket/SendFile/Internal.hs +8/−0
- src/Network/Socket/SendFile/Portable.hs +5/−0
sendfile.cabal view
@@ -1,5 +1,5 @@ name: sendfile-version: 0.7.9+version: 0.7.10 stability: provisional synopsis: A portable sendfile library description: A library which exposes zero-copy sendfile functionality in a portable way. If a platform does not support sendfile, a fallback implementation in haskell is provided.@@ -14,6 +14,7 @@ category: Network build-type: Simple cabal-version: >= 1.6+tested-with: GHC == 7.8.4, GHC == 7.10.2, GHC==8.0.1, GHC==8.2.2, GHC==8.4.1, GHC==8.6.1 flag portable description: Explicitly enable portable sendfile support (implemented in Haskell)@@ -30,9 +31,9 @@ other-modules: Network.Socket.SendFile.Internal Network.Socket.SendFile.Util - build-depends: base >= 3 && < 5,+ build-depends: base >= 3 && < 5, bytestring >= 0.9.1.4 && < 0.11,- network >= 2 && < 3+ network >= 2 && < 3.1 ghc-options: -Wall @@ -58,4 +59,4 @@ source-repository head type: darcs- location: http://patch-tag.com/r/mae/sendfile/pullrepo+ location: http://hub.darcs.net/stepcut/sendfile
src/Network/Socket/SendFile/Internal.hs view
@@ -77,14 +77,22 @@ #else sendFile'' :: Socket -> Handle -> Integer -> Integer -> IO () sendFile'' outs inh off count =+#if MIN_VERSION_network(3,0,0)+ do out_fd <- Fd <$> (fdSocket outs)+#else do let out_fd = Fd (fdSocket outs)+#endif withFd inh $ \in_fd -> wrapSendFile' (\out_fd_ in_fd_ _blockSize_ off_ count_ -> _sendFile out_fd_ in_fd_ off_ count_) out_fd in_fd count off count sendFileIterWith'' :: (IO Iter -> IO a) -> Socket -> Handle -> Integer -> Integer -> Integer -> IO a sendFileIterWith'' stepper outs inp blockSize off count =+#if MIN_VERSION_network(3,0,0)+ do out_fd <- Fd <$> (fdSocket outs)+#else do let out_fd = Fd (fdSocket outs)+#endif withFd inp $ \in_fd -> stepper $ wrapSendFile' sendFileIter out_fd in_fd blockSize off count
src/Network/Socket/SendFile/Portable.hs view
@@ -75,7 +75,12 @@ else Nothing let cont = sendFileIterS socket inh blockSize {- (off + (fromIntegral nsent)) -} (remaining `safeMinus` (fromIntegral nsent)) leftOver if nsent < (length buf)+#if MIN_VERSION_network(3,0,0)+ then do fd <- fdSocket socket+ return (WouldBlock (fromIntegral nsent) (Fd fd) cont)+#else then return (WouldBlock (fromIntegral nsent) (Fd $ fdSocket socket) cont)+#endif else return (Sent (fromIntegral nsent) cont) where nextBlock =