From c71773184633402e2a47ea6c3bc6be639cddc744 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 18 Nov 2009 00:08:21 -0800 Subject: Thread*: start implementing keepalive timeout If the Revactor implementation using lightweight Actors/Fibers needs it, then thread implementations do, too. --- lib/rainbows/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/rainbows/base.rb') 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 -- cgit v1.2.3-24-ge0c7