about summary refs log tree commit homepage
path: root/lib/rainbows/epoll
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-11-21 08:52:29 +0000
committerEric Wong <e@80x24.org>2015-11-21 08:55:00 +0000
commita5d88662a519406eea6f180a010af8ef829464e7 (patch)
tree77034a0a236921b1ab2c6c237ac92a016de49c10 /lib/rainbows/epoll
parent9e7fb4e9b5d97cc75892c8faaea46444d438eb61 (diff)
downloadrainbows-a5d88662a519406eea6f180a010af8ef829464e7.tar.gz
unicorn 5 will only support Ruby 1.9.3 and later, so remove
some checks for Hash#compare_by_identity and IO.copy_stream
which we know exist in Ruby 1.9.

Favor &:sym proc dispatch to avoid unnecessary captures and
bytecode size increases, too.

Finally, ensure we fail fast by converting some literal
hashes to use non-arrow syntax for symbolic keys.
Diffstat (limited to 'lib/rainbows/epoll')
-rw-r--r--lib/rainbows/epoll/client.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/rainbows/epoll/client.rb b/lib/rainbows/epoll/client.rb
index fe04258..85e504c 100644
--- a/lib/rainbows/epoll/client.rb
+++ b/lib/rainbows/epoll/client.rb
@@ -9,9 +9,8 @@ module Rainbows::Epoll::Client
   IN = SleepyPenguin::Epoll::IN | SleepyPenguin::Epoll::ONESHOT
   OUT = SleepyPenguin::Epoll::OUT | SleepyPenguin::Epoll::ONESHOT
   EPINOUT = IN | OUT
-  KATO = {}
-  KATO.compare_by_identity if KATO.respond_to?(:compare_by_identity)
-  Rainbows.at_quit { KATO.each_key { |k| k.timeout! }.clear }
+  KATO = {}.compare_by_identity
+  Rainbows.at_quit { KATO.each_key(&:timeout!).clear }
   Rainbows.config!(self, :keepalive_timeout)
   EP = Rainbows::EP
   @@last_expire = Rainbows.now