diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-25 16:14:49 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-26 02:26:22 -0700 |
commit | 8487d928f9581d98aee14e1991f129422278367c (patch) | |
tree | 04eb15c1f8494e948d9b9882ecf4371c77b04536 | |
parent | 344f8cf1e000704d53d7841eb896d83b470d7a08 (diff) | |
download | rainbows-8487d928f9581d98aee14e1991f129422278367c.tar.gz |
Graceful quit means we finish sending everything we have before exiting. Additionally, only signal quits after we've queued the error response up.
-rw-r--r-- | lib/rainbows/ev_core.rb | 3 | ||||
-rw-r--r-- | lib/rainbows/rev.rb | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index aa0b155..d8304a3 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -19,12 +19,10 @@ module Rainbows # graceful exit, like SIGQUIT def quit - @deferred_bodies.clear @state = :close end def handle_error(e) - quit msg = case e when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF ERROR_500_RESPONSE @@ -36,6 +34,7 @@ module Rainbows ERROR_500_RESPONSE end write(msg) + quit end def tmpio diff --git a/lib/rainbows/rev.rb b/lib/rainbows/rev.rb index 572b88a..89f893a 100644 --- a/lib/rainbows/rev.rb +++ b/lib/rainbows/rev.rb @@ -62,7 +62,7 @@ module Rainbows # keepalive requests are always body-less, so @input is unchanged @hp.headers(@env, @buf) and next else - @state = :close + quit end return end while true |