about summary refs log tree commit homepage
path: root/lib/rainbows/base.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-18 00:08:21 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-18 00:08:21 -0800
commitc71773184633402e2a47ea6c3bc6be639cddc744 (patch)
treefb83a1e6926b951bdbf0ab1cdeee91f7883ec6b9 /lib/rainbows/base.rb
parentfc931be708f8da823a484fe88da9251d9cc72949 (diff)
downloadrainbows-c71773184633402e2a47ea6c3bc6be639cddc744.tar.gz
If the Revactor implementation using lightweight Actors/Fibers
needs it, then thread implementations do, too.
Diffstat (limited to 'lib/rainbows/base.rb')
-rw-r--r--lib/rainbows/base.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb
index 4597239..62a7701 100644
--- a/lib/rainbows/base.rb
+++ b/lib/rainbows/base.rb
@@ -32,7 +32,7 @@ module Rainbows
     # once a client is accepted, it is processed in its entirety here
     # in 3 easy steps: read request, call app, write app response
     def process_client(client)
-      buf = client.readpartial(CHUNK_SIZE)
+      buf = client.readpartial(CHUNK_SIZE) # accept filters protect us here
       hp = HttpParser.new
       env = {}
       alive = true
@@ -40,6 +40,7 @@ module Rainbows
 
       begin # loop
         while ! hp.headers(env, buf)
+          IO.select([client], nil, nil, 5) or return client.close
           buf << client.readpartial(CHUNK_SIZE)
         end