about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-22 07:40:03 +0000
committerEric Wong <normalperson@yhbt.net>2011-06-22 07:40:03 +0000
commit8c1e3da65d7a709c6578652fa57e5ca0e7a9a459 (patch)
tree9891c2f58fa6dbeb357a82a53c8da419e94b97fe
parent63aff8f1cffebaeb6320a5f6d2ec8cb9c7d8ea54 (diff)
Some pipe responses can trigger the on_deferred_write_complete
method without ever re-running the event loop.

This appears to be the result of the occasional t0050 failures.
-rw-r--r--lib/rainbows/epoll/client.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rainbows/epoll/client.rb b/lib/rainbows/epoll/client.rb
index d3a06eb..891e959 100644
--- a/lib/rainbows/epoll/client.rb
+++ b/lib/rainbows/epoll/client.rb
@@ -96,12 +96,12 @@ module Rainbows::Epoll::Client
   end
 
   def ev_write_response(status, headers, body, alive)
+    @state = alive ? :headers : :close
     if body.respond_to?(:to_path)
       write_response_path(status, headers, body, alive)
     else
       write_response(status, headers, body, alive)
     end
-    @state = alive ? :headers : :close
     on_read(Z) if alive && 0 == @wr_queue.size && 0 != @buf.size
   end