about summary refs log tree commit homepage
path: root/lib/rainbows/writer_thread_pool.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-03 14:55:37 -0700
committerEric Wong <normalperson@yhbt.net>2010-06-03 15:26:01 -0700
commit5a0a190253434d3eef5332d979d56f3e16e876bd (patch)
tree23fc4e136eafe0688260bebc27c4d05fc5c26512 /lib/rainbows/writer_thread_pool.rb
parentb6e354116d4da5c7c6de59f87ab5815f21e202ed (diff)
downloadrainbows-5a0a190253434d3eef5332d979d56f3e16e876bd.tar.gz
While these models are designed to work with IO.copy_stream
under Ruby 1.9, it should be possible to run them under Ruby
1.8 without returning corrupt responses.  The large file
response test is beefed up to compare SHA1 checksums of
the served file, not just sizes.
Diffstat (limited to 'lib/rainbows/writer_thread_pool.rb')
-rw-r--r--lib/rainbows/writer_thread_pool.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/rainbows/writer_thread_pool.rb b/lib/rainbows/writer_thread_pool.rb
index ec07ccd..f7eb2aa 100644
--- a/lib/rainbows/writer_thread_pool.rb
+++ b/lib/rainbows/writer_thread_pool.rb
@@ -46,13 +46,8 @@ module Rainbows
       end
     end
 
-    alias base_write_body write_body
-    if IO.respond_to?(:copy_stream)
-      undef_method :write_body
-
-      def write_body(qclient, body)
-        qclient.q << [ qclient.to_io, :body, body ]
-      end
+    def write_body(qclient, body)
+      qclient.q << [ qclient.to_io, :body, body ]
     end
 
     @@nr = 0
@@ -71,7 +66,7 @@ module Rainbows
           begin
             io, arg1, arg2 = response
             case arg1
-            when :body then base_write_body(io, arg2)
+            when :body then Base.write_body(io, arg2)
             when :close then io.close unless io.closed?
             else
               io.write(arg1)