on master help sign in
Theoretical Comet support
commit5ed535db69605ec788ecf58d8668a11d78169482 authorMichael Snoyman <michael@snoyman.com> dateSat 12 Feb 2011, 22:30 (16 years ago) parent130be2b
1 file changed+7−2
Network/Wai/Handler/Warp.hs+7−2
Network/Wai/Handler/Warp.hs+7−2
@@ -402,11 +402,16 @@ iterSocket :: T.Handle
402402iterSocket th sock =
403403 E.continue step
404404 where
405− step E.EOF = E.yield () E.EOF
405+ -- We pause timeouts before passing control back to user code. This ensures
406+ -- that a timeout will only ever be executed when Warp is in control. We
407+ -- also make sure to resume the timeout after the completion of user code
408+ -- so that we can kill idle connections.
409+ step E.EOF = liftIO (T.resume th) >> E.yield () E.EOF
406410 step (E.Chunks []) = E.continue step
407411 step (E.Chunks xs) = do
412+ liftIO $ T.resume th
408413 liftIO $ Sock.sendMany sock xs
409− liftIO $ T.tickle th
414+ liftIO $ T.pause th
410415 E.continue step
411416
412417data Settings = Settings