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  bf50ce5ed3c8f612444124ad851295c82a20a2ff (commit)
      from  350f0d2fd10857560dc6af48353d5a3c589d4829 (commit)


Summary of changes:
 src/Snap/Internal/Http/Server/LibevBackend.hs  |    2 +-
 src/Snap/Internal/Http/Server/SimpleBackend.hs |   13 ++++++++++---
 2 files changed, 11 insertions(+), 4 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 bf50ce5ed3c8f612444124ad851295c82a20a2ff
Author: Gregory Collins <[email protected]>
Date:   Fri Sep 10 17:47:03 2010 -0400

    Fix broken slowloris test on standard backend

diff --git a/src/Snap/Internal/Http/Server/LibevBackend.hs 
b/src/Snap/Internal/Http/Server/LibevBackend.hs
index d173908..5627768 100644
--- a/src/Snap/Internal/Http/Server/LibevBackend.hs
+++ b/src/Snap/Internal/Http/Server/LibevBackend.hs
@@ -638,7 +638,7 @@ tickleTimeout :: Connection -> IO ()
 tickleTimeout conn = do
     debug "Backend.tickleTimeout"
     now       <- getCurrentDateTime
-    writeIORef (_timerTimeoutTime conn) (now + 20)
+    writeIORef (_timerTimeoutTime conn) (now + 30)
 
 
 recvData :: Connection -> Int -> IO ByteString
diff --git a/src/Snap/Internal/Http/Server/SimpleBackend.hs 
b/src/Snap/Internal/Http/Server/SimpleBackend.hs
index 61c8afb..5879e24 100644
--- a/src/Snap/Internal/Http/Server/SimpleBackend.hs
+++ b/src/Snap/Internal/Http/Server/SimpleBackend.hs
@@ -163,13 +163,19 @@ timeoutThread backend = loop
         return t'
 
 
-    -- timeout = 60 seconds
-    tIMEOUT = 60
+    -- timeout = 30 seconds
+    tIMEOUT = 30
 
     killOlderThan now !table = do
+        debug "Backend.timeoutThread: killing old connections"
         let mmin = PSQ.findMin table
         maybe (return table)
-              (\m -> if now - PSQ.prio m > tIMEOUT
+              (\m -> do
+                   debug $ "Backend.timeoutThread: minimum value "
+                            ++ show (PSQ.prio m) ++ ", cutoff="
+                            ++ show (now - tIMEOUT)
+
+                   if now - PSQ.prio m >= tIMEOUT
                        then do
                            killThread $ PSQ.key m
                            killOlderThan now $ PSQ.deleteMin table
@@ -314,6 +320,7 @@ tickleTimeout conn = do
 
 cancelTimeout :: Connection -> IO ()
 cancelTimeout conn = do
+    debug "Backend.cancelTimeout"
     tid <- readMVar $ _connTid conn
 
     atomicModifyIORef tedits $ \es -> (D.snoc es (PSQ.delete tid), ())
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap-server
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to