about summary refs log tree commit homepage
path: root/lib/rainbows/base.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-28 06:29:54 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-28 06:30:23 +0000
commit86e9c7013308d77def5fe41b52a35dea60c7361c (patch)
treeed9ca86f78cb455958a47b0acf28ba98fb5613e2 /lib/rainbows/base.rb
parentb75ad975856a681fe96651592b2bb24cc044fd50 (diff)
downloadrainbows-86e9c7013308d77def5fe41b52a35dea60c7361c.tar.gz
This fleshes out Rainbows::Fiber::IO with a few
more methods for people using it.
Diffstat (limited to 'lib/rainbows/base.rb')
-rw-r--r--lib/rainbows/base.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb
index 435c818..2627719 100644
--- a/lib/rainbows/base.rb
+++ b/lib/rainbows/base.rb
@@ -59,6 +59,10 @@ module Rainbows::Base
 
   module_function :write_body
 
+  def wait_headers_readable(client)
+    IO.select([client], nil, nil, G.kato)
+  end
+
   # once a client is accepted, it is processed in its entirety here
   # in 3 easy steps: read request, call app, write app response
   # this is used by synchronous concurrency models
@@ -72,7 +76,7 @@ module Rainbows::Base
 
     begin # loop
       until hp.headers(env, buf)
-        IO.select([client], nil, nil, G.kato) or return
+        wait_headers_readable(client) or return
         buf << client.readpartial(CHUNK_SIZE)
       end