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/http_response.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/http_response.rb')
-rw-r--r-- | lib/yahns/http_response.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb index b6228e5..3ee4e21 100644 --- a/lib/yahns/http_response.rb +++ b/lib/yahns/http_response.rb @@ -52,8 +52,8 @@ module Yahns::HttpResponse # :nodoc: case rv # trysendfile return value when nil case alive - when :delete - @state = :delete + when :ignore + @state = :ignore when true, false http_response_done(alive) end @@ -140,7 +140,7 @@ module Yahns::HttpResponse # :nodoc: if hijack hijack.call(self) - return :delete # trigger EPOLL_CTL_DEL + return :ignore end if body.respond_to?(:to_path) |