[PATCH] close_connection_after_writing only if not deferred, as in cool.io

Lin Jen-Shin (godfat) godfat at godfat.org
Tue Dec 18 20:36:17 UTC 2012


I don't have 100% confidence about this,
but running test suite "t/t0002-graceful.sh"
during my development for EventMachineThreadPool
would need this to properly pass the tests.

I think this would be needed while using
`throw :async' as well?

The patch is also available on Github:
https://github.com/godfat/rainbows/pull/1

>From bd5c38005f44bbe003bd416f7f871f15b0010c85 Mon Sep 17 00:00:00 2001
From: Lin Jen-Shin <godfat at godfat.org>
Date: Wed, 19 Dec 2012 04:03:55 +0800
Subject: [PATCH] close_connection_after_writing only if not deferred, as in
 cool.io

---
 lib/rainbows/event_machine/client.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rainbows/event_machine/client.rb
b/lib/rainbows/event_machine/client.rb
index fc0dfe3..ebb6f17 100644
--- a/lib/rainbows/event_machine/client.rb
+++ b/lib/rainbows/event_machine/client.rb
@@ -28,7 +28,7 @@ class Rainbows::EventMachine::Client < EM::Connection

   def quit
     super
-    close_connection_after_writing
+    close_connection_after_writing if nil == @deferred
   end

   def app_call input
-- 
1.8.0.2


More information about the rainbows-talk mailing list