yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] fix compatibility with unicorn.git
@ 2015-02-05 20:37 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-02-05 20:37 UTC (permalink / raw)
  To: yahns-public; +Cc: Eric Wong

Install workarounds for running with unreleased versions of unicorn
for now, as unicorn 5.x will be dropping many needless features.
---
 lib/yahns.rb             | 4 +++-
 lib/yahns/http_client.rb | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/yahns.rb b/lib/yahns.rb
index d48b34d..a55837f 100644
--- a/lib/yahns.rb
+++ b/lib/yahns.rb
@@ -10,7 +10,9 @@ require 'sleepy_penguin'
 # on unicorn at all
 [ :ClientShutdown, :Const, :SocketHelper, :StreamInput, :TeeInput,
   :SSLConfigurator, :Configurator, :TmpIO, :Util, :Worker, :SSLServer,
-  :HttpServer ].each { |sym| Unicorn.__send__(:remove_const, sym) }
+  :HttpServer ].each do |sym|
+    Unicorn.__send__(:remove_const, sym) if Unicorn.const_defined?(sym)
+end
 
 # yahns exposes no user-visible API outside of the config file
 # Internals are subject to change.
diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb
index a294511..15ee9d4 100644
--- a/lib/yahns/http_client.rb
+++ b/lib/yahns/http_client.rb
@@ -4,8 +4,9 @@
 class Yahns::HttpClient < Kgio::Socket # :nodoc:
   NULL_IO = StringIO.new("")
 
-  # FIXME: we shouldn't have this at all
-  Unicorn::HttpParser.keepalive_requests = 0xffffffff
+  # FIXME: we shouldn't have this at all when we go Unicorn 5-only
+  Unicorn::HttpParser.respond_to?(:keepalive_requests=) and
+    Unicorn::HttpParser.keepalive_requests = 0xffffffff
 
   include Yahns::HttpResponse
   QEV_FLAGS = Yahns::Queue::QEV_RD # used by acceptor
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-05 20:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05 20:37 [PATCH] fix compatibility with unicorn.git Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).