packages feed

simple-sendfile 0.2.18 → 0.2.19

raw patch · 2 files changed

+11/−3 lines, 2 files

Files

Network/Sendfile/Linux.hsc view
@@ -18,7 +18,7 @@ import Foreign.Marshal (alloca) import Foreign.Ptr (Ptr, plusPtr, castPtr) import Foreign.ForeignPtr-import Foreign.Storable (poke)+import Foreign.Storable (poke, sizeOf) import GHC.Conc (threadWaitWrite) import Network.Sendfile.Types import Network.Socket@@ -29,6 +29,11 @@ #include <sys/sendfile.h> #include <sys/socket.h> +safeSize :: CSize+safeSize+  | sizeOf (0 :: CSize) == 8 = 2^(60 :: Int)+  | otherwise                = 2^(30 :: Int)+ ----------------------------------------------------------------  -- |@@ -90,7 +95,10 @@ sendfileloop dst src offp len hook = do     -- Multicore IO manager use edge-trigger mode.     -- So, calling threadWaitWrite only when errnor is eAGAIN.-    bytes <- c_sendfile dst src offp len+    let toSend+          | len > safeSize = safeSize+          | otherwise      = len+    bytes <- c_sendfile dst src offp toSend     case bytes of         -1 -> do             errno <- getErrno
simple-sendfile.cabal view
@@ -1,5 +1,5 @@ Name:                   simple-sendfile-Version:                0.2.18+Version:                0.2.19 Author:                 Kazu Yamamoto <kazu@iij.ad.jp> Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp> License:                BSD3