about summary refs log tree commit homepage
path: root/lib/rainbows/event_machine.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-26 03:30:36 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-26 09:53:30 +0000
commit7bfd7995fd403f80940e3f6ac36f9ae58b7040cb (patch)
treee5822c83d2e429d893461dc32d4f0478ea281525 /lib/rainbows/event_machine.rb
parent92a11cdfe00c5e551388c2cc1a62bfc59d568c6f (diff)
downloadrainbows-7bfd7995fd403f80940e3f6ac36f9ae58b7040cb.tar.gz
The HttpParser#next? method will come with keepalive protection
for Rainbows!, which can prevent clients from monopolizing a
server with excessive pipelining/keepalive requests.
Diffstat (limited to 'lib/rainbows/event_machine.rb')
-rw-r--r--lib/rainbows/event_machine.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index 99fa32e..8029b1a 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -91,10 +91,9 @@ module Rainbows::EventMachine
       # long-running async response
       (response.nil? || -1 == response[0]) and return @state = :close
 
-      alive = @hp.keepalive? && G.alive && G.kato > 0
+      alive = @hp.next? && G.alive && G.kato > 0
       em_write_response(response, alive)
       if alive
-        @hp.reset
         @state = :headers
         if @buf.empty?
           set_comm_inactivity_timeout(G.kato)