diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-22 09:13:45 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-22 09:19:49 +0000 |
commit | b3a8d6aeccf2d865450b883d8b5cc166442f6205 (patch) | |
tree | 3193993afb45922d4756ba71af4a050c2037aed1 /lib/rainbows/writer_thread_pool.rb | |
parent | 416d3a0f868571319a2b29b0034d2dba68e4d5b3 (diff) | |
download | rainbows-b3a8d6aeccf2d865450b883d8b5cc166442f6205.tar.gz |
This was always an issue, but not noticed until 0cd65fa1e01be369b270c72053cf21a3d6bcb45f ...
Diffstat (limited to 'lib/rainbows/writer_thread_pool.rb')
-rw-r--r-- | lib/rainbows/writer_thread_pool.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/rainbows/writer_thread_pool.rb b/lib/rainbows/writer_thread_pool.rb index dd3dd7c..c4d8d9f 100644 --- a/lib/rainbows/writer_thread_pool.rb +++ b/lib/rainbows/writer_thread_pool.rb @@ -46,25 +46,25 @@ module Rainbows end end - module Response # :nodoc: - def write_body(qclient, body, range) - qclient.q << [ qclient.to_io, :body, body, range ] - end - end - @@nr = 0 @@q = nil + def async_write_body(qclient, body, range) + qclient.q << [ qclient.to_io, :body, body, range ] + end + def process_client(client) # :nodoc: @@nr += 1 - super(QueueSocket[client, @@q[@@nr %= @@q.size]]) + super(QueueSocket.new(client, @@q[@@nr %= @@q.size])) end - def worker_loop(worker) # :nodoc: - Rainbows::Response.setup(self.class) + def init_worker_process(worker) + super self.class.__send__(:alias_method, :sync_write_body, :write_body) - self.class.__send__(:include, Response) + WriterThreadPool.__send__(:alias_method, :write_body, :async_write_body) + end + def worker_loop(worker) # :nodoc: # we have multiple, single-thread queues since we don't want to # interleave writes from the same client qp = (1..worker_connections).map do |n| |