From bcd0825fc77a2986aebb3f1f5a653a64faf6a8c5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 16 May 2011 21:01:47 +0000 Subject: writer_thread_*: fix sendfile detection under Ruby 1.8 I can't wait until I stop supporting Ruby 1.8 --- lib/rainbows/writer_thread_pool/client.rb | 2 +- lib/rainbows/writer_thread_spawn/client.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rainbows/writer_thread_pool/client.rb b/lib/rainbows/writer_thread_pool/client.rb index fd537ed..4df7f49 100644 --- a/lib/rainbows/writer_thread_pool/client.rb +++ b/lib/rainbows/writer_thread_pool/client.rb @@ -18,7 +18,7 @@ class Rainbows::WriterThreadPool::Client < Struct.new(:to_io, :q) } end - if Rainbows::Response::COPY_STREAM + if Rainbows::Response::COPY_STREAM || IO.method_defined?(:trysendfile) def write_response(status, headers, body, alive) if body.respond_to?(:close) write_response_close(status, headers, body, alive) diff --git a/lib/rainbows/writer_thread_spawn/client.rb b/lib/rainbows/writer_thread_spawn/client.rb index de51c17..84c1e7c 100644 --- a/lib/rainbows/writer_thread_spawn/client.rb +++ b/lib/rainbows/writer_thread_spawn/client.rb @@ -21,7 +21,7 @@ class Rainbows::WriterThreadSpawn::Client < Struct.new(:to_io, :q, :thr) } end - if Rainbows::Response::COPY_STREAM + if Rainbows::Response::COPY_STREAM || IO.method_defined?(:trysendfile) def write_response(status, headers, body, alive) self.q ||= queue_writer if body.respond_to?(:close) -- cgit v1.2.3-24-ge0c7