diff options
author | Eric Wong <e@80x24.org> | 2013-10-19 02:47:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2013-10-19 02:47:58 +0000 |
commit | 9cd4a50c275bbda9ee23f0351f1eba2289af075f (patch) | |
tree | e7051daa5f7fd691133a9c48e047468df39b9e63 /lib/yahns/fdmap.rb | |
parent | 2377d5a1cafa518313b0b597e4c3af65bb57f887 (diff) | |
download | yahns-9cd4a50c275bbda9ee23f0351f1eba2289af075f.tar.gz |
Rack hijacking may close the socket before it yields control back to our epoll event loop. So it's not safe to attempt to use the socket (or even get the .fileno) with :delete/EPOLL_CTL_DEL. So change :delete to :ignore, and only decrement the FD counter to allow yahns to do graceful shutdown. This means we'll potentially waste ~200 bytes of kernel memory due to epoll overhead until the FD is closed by the app hijacking. I'm not sure how Rack servers handle graceful shutdown when hijacking, but maybe they just retrap SIGQUIT...
Diffstat (limited to 'lib/yahns/fdmap.rb')
-rw-r--r-- | lib/yahns/fdmap.rb | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/lib/yahns/fdmap.rb b/lib/yahns/fdmap.rb index 1e1677a..d83898b 100644 --- a/lib/yahns/fdmap.rb +++ b/lib/yahns/fdmap.rb @@ -54,14 +54,6 @@ class Yahns::Fdmap # :nodoc: @fdmap_mtx.synchronize { @count -= 1 } end - def delete(io) # use with rack.hijack (via yahns) - fd = io.fileno - @fdmap_mtx.synchronize do - @fdmap_ary[fd] = nil - @count -= 1 - end - end - # expire a bunch of idle clients and register the current one # We should not be calling this too frequently, it is expensive # This is called while @fdmap_mtx is held |