Skip to content

Commit

Permalink
Have libev's timeout thread initially use the defaultTimeout, and mak…
Browse files Browse the repository at this point in the history
…e sure send always updates the timeout thread
  • Loading branch information
jay groven committed Oct 5, 2011
1 parent 04e866c commit 134d5cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Snap/Internal/Http/Server/HttpPort.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ send tickleTimeout onBlock (NetworkSession s _ _) bs =
let sent' = fromIntegral sent
if sent' < len
then tickleTimeout >> loop (plusPtr ptr sent') (len - sent')
else return ()
else tickleTimeout


------------------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions src/Snap/Internal/Http/Server/LibevBackend.hs
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,12 @@ runSession defaultTimeout backend handler lsock fd = do
-----------------
tmr <- mkEvTimer
now <- getCurrentDateTime
timeoutTime <- newIORef $ now + 20
timeoutTime <- newIORef $ now + (fromIntegral defaultTimeout)
tcb <- mkTimerCallback $ timerCallback lp
tmr
timeoutTime
tid
-- 20 second timeout
evTimerInit tmr tcb 0 20.0
evTimerInit tmr tcb 0 (fromIntegral defaultTimeout)


readActive <- newIORef True
Expand Down

0 comments on commit 134d5cf

Please sign in to comment.