diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-28 06:29:54 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-28 06:30:23 +0000 |
commit | 86e9c7013308d77def5fe41b52a35dea60c7361c (patch) | |
tree | ed9ca86f78cb455958a47b0acf28ba98fb5613e2 /lib/rainbows/base.rb | |
parent | b75ad975856a681fe96651592b2bb24cc044fd50 (diff) | |
download | rainbows-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.rb | 6 |
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 |