on master help sign in
Theoretical Comet support
5ed535dMichael Snoyman
Network/Wai/Handler/Warp.hs+7−2
@@ -402,11 +402,16 @@ iterSocket :: T.Handle
402iterSocket th sock =
402iterSocket th sock =
403 E.continue step
403 E.continue step
404 where
404 where
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.
405− step E.EOF = E.yield () E.EOF
409+ step E.EOF = liftIO (T.resume th) >> E.yield () E.EOF
406 step (E.Chunks []) = E.continue step
410 step (E.Chunks []) = E.continue step
407 step (E.Chunks xs) = do
411 step (E.Chunks xs) = do
412+ liftIO $ T.resume th
408 liftIO $ Sock.sendMany sock xs
413 liftIO $ Sock.sendMany sock xs
409− liftIO $ T.tickle th
414+ liftIO $ T.pause th
410 E.continue step
415 E.continue step
411
416
412data Settings = Settings
417data Settings = Settings