about summary refs log tree commit homepage
diff options
authorEric Wong <e@80x24.org>2017-04-02 01:54:01 +0000
committerEric Wong <e@80x24.org>2017-04-02 02:04:11 +0000
commitd07b6fd6888367c6230cf950d149bb6934ac11bf (patch)
parent7bfff8a869a29828932685cf49c4992a9d688918 (diff)
unicorn 5.3.0 introduced a new Unicorn::TCPSrv and
Unicorn::TCPClient constants to distinguish TCP sockets
from Unix ones from its check_client_connection feature.

These classes screw up our direct inheritance of Kgio::Socket
from the Rainbows::Client class.  Since we do not support
check_client_connection, we do not need these new classes in
unicorn.  Removing Unicorn::TCPSrv and aliasing it as
Kgio::TCPServer is sufficient for now.  In the future,
removing all kgio dependencies from Rainbows! will be prioritized.

Thanks to Claudio Poli for reporting the bug:

1 files changed, 9 insertions, 0 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index acfe911..584c94b 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -149,3 +149,12 @@ end
 require 'rainbows/error'
 require 'rainbows/configurator'
+module Unicorn
+  # this interferes with Rainbows::Client creation with unicorn 5.3
+  begin
+    remove_const :TCPSrv
+    TCPSrv = Kgio::TCPServer
+  rescue NameError # unicorn < 5.3.0
+  end