about summary refs log tree commit homepage
path: root/lib/yahns/queue_epoll.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-04-03 00:13:28 +0000
committerEric Wong <e@80x24.org>2015-04-03 01:52:08 +0000
commit78f23338ef08fe98e7d90d35ba1f8356de51e3d4 (patch)
tree787908fa9861c9c9f6278d1f1bfcfb11db225181 /lib/yahns/queue_epoll.rb
parent44e533af884bcebd38a319287f359cbfbc161b55 (diff)
downloadyahns-78f23338ef08fe98e7d90d35ba1f8356de51e3d4.tar.gz
This allows our reverse proxy to avoid having an innefficient 1:1
relationship between threads and upstream connections, reducing
memory usage when there are many upstream connections (possibly to
multiple backend machines).
Diffstat (limited to 'lib/yahns/queue_epoll.rb')
-rw-r--r--lib/yahns/queue_epoll.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb
index da90a95..10ff607 100644
--- a/lib/yahns/queue_epoll.rb
+++ b/lib/yahns/queue_epoll.rb
@@ -27,9 +27,14 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc:
     epoll_ctl(Epoll::CTL_ADD, io, flags)
   end
 
+  def queue_mod(io, flags)
+    epoll_ctl(Epoll::CTL_MOD, io, flags)
+  end
+
   def thr_init
     Thread.current[:yahns_rbuf] = ""
     Thread.current[:yahns_fdmap] = @fdmap
+    Thread.current[:yahns_queue] = self
   end
 
   # returns an array of infinitely running threads