This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-server".
The branch, master has been updated
via fc053a841da71184a0139205f72b44fd22027088 (commit)
via 829589ed66975c43389a7adae620ef3c8fc533ad (commit)
from 9bc3ddc7b4f827c9f924b54ff490716794587c76 (commit)
Summary of changes:
src/Snap/Internal/Http/Server/LibevBackend.hs | 9 +++++----
src/Snap/Internal/Http/Server/SimpleBackend.hs | 9 +++++----
2 files changed, 10 insertions(+), 8 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fc053a841da71184a0139205f72b44fd22027088
Merge: 829589e 9bc3ddc
Author: Shu-yu Guo <[email protected]>
Date: Tue Jun 8 13:08:26 2010 -0700
Merge branch 'master' of git.snapframework.com:snap-server
diff --cc src/Snap/Internal/Http/Server/SimpleBackend.hs
index e882906,1846820..61c8afb
--- a/src/Snap/Internal/Http/Server/SimpleBackend.hs
+++ b/src/Snap/Internal/Http/Server/SimpleBackend.hs
@@@ -91,14 -91,13 +91,14 @@@ name :: ByteStrin
name = "simple"
- sendFile :: Connection -> FilePath -> Int -> IO ()
+ sendFile :: Connection -> FilePath -> Int64 -> IO ()
#if defined(HAS_SENDFILE)
sendFile c fp sz = do
- fd <- openFd fp ReadOnly Nothing defaultFileFlags
- go fd 0 sz
+ bracket (openFd fp ReadOnly Nothing defaultFileFlags)
+ (closeFd)
+ (go 0 sz)
where
- go fd off bytes
+ go off bytes fd
| bytes == 0 = return ()
| otherwise = do
sent <- SF.sendFile sfd fd off bytes
commit 829589ed66975c43389a7adae620ef3c8fc533ad
Author: Shu-yu Guo <[email protected]>
Date: Tue Jun 8 13:05:43 2010 -0700
Fix file descriptor leak with sendfile stuff
diff --git a/src/Snap/Internal/Http/Server/LibevBackend.hs
b/src/Snap/Internal/Http/Server/LibevBackend.hs
index 7fdfd0e..5933489 100644
--- a/src/Snap/Internal/Http/Server/LibevBackend.hs
+++ b/src/Snap/Internal/Http/Server/LibevBackend.hs
@@ -128,8 +128,9 @@ sendFile c fp _ = do
evAsyncSend loop asy
#if defined(HAS_SENDFILE)
- fd <- openFd fp ReadOnly Nothing defaultFileFlags
- go fd 0 sz
+ bracket (openFd fp ReadOnly Nothing defaultFileFlags)
+ (closeFd)
+ (go 0 sz)
#else
-- no need to count bytes
enumFile fp (getWriteEnd c) >>= run
@@ -143,12 +144,12 @@ sendFile c fp _ = do
where
#if defined(HAS_SENDFILE)
- go fd off bytes
+ go off bytes fd
| bytes == 0 = return ()
| otherwise = do
sent <- SF.sendFile sfd fd off bytes
if sent < bytes
- then tickleTimeout c >> go fd (off+sent) (bytes-sent)
+ then tickleTimeout c >> go (off+sent) (bytes-sent) fd
else return ()
sfd = Fd $ _socketFd c
diff --git a/src/Snap/Internal/Http/Server/SimpleBackend.hs
b/src/Snap/Internal/Http/Server/SimpleBackend.hs
index b54d867..e882906 100644
--- a/src/Snap/Internal/Http/Server/SimpleBackend.hs
+++ b/src/Snap/Internal/Http/Server/SimpleBackend.hs
@@ -94,15 +94,16 @@ name = "simple"
sendFile :: Connection -> FilePath -> Int -> IO ()
#if defined(HAS_SENDFILE)
sendFile c fp sz = do
- fd <- openFd fp ReadOnly Nothing defaultFileFlags
- go fd 0 sz
+ bracket (openFd fp ReadOnly Nothing defaultFileFlags)
+ (closeFd)
+ (go 0 sz)
where
- go fd off bytes
+ go off bytes fd
| bytes == 0 = return ()
| otherwise = do
sent <- SF.sendFile sfd fd off bytes
if sent < bytes
- then tickleTimeout c >> go fd (off+sent) (bytes-sent)
+ then tickleTimeout c >> go (off+sent) (bytes-sent) fd
else return ()
sfd = Fd . fdSocket $ _socket c
-----------------------------------------------------------------------
hooks/post-receive
--
snap-server
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap