diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/yahns/fdmap.rb | 8 | ||||
-rw-r--r-- | lib/yahns/http_client.rb | 10 | ||||
-rw-r--r-- | lib/yahns/http_response.rb | 6 | ||||
-rw-r--r-- | lib/yahns/queue_epoll.rb | 5 | ||||
-rw-r--r-- | lib/yahns/wbuf_common.rb | 2 |
5 files changed, 11 insertions, 20 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 diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb index e95bb47..ce55525 100644 --- a/lib/yahns/http_client.rb +++ b/lib/yahns/http_client.rb @@ -33,9 +33,9 @@ class Yahns::HttpClient < Kgio::Socket # :nodoc: case rv = @state.wbuf_flush(self) when :wait_writable, :wait_readable return rv # tell epoll/kqueue to wait on this more - when :delete # :delete on hijack - @state = :delete - return :delete + when :ignore # :ignore on hijack + @state = :ignore + return :ignore when Yahns::StreamFile @state = rv # continue looping when true, false # done @@ -159,9 +159,9 @@ class Yahns::HttpClient < Kgio::Socket # :nodoc: # run the rack app response = k.app.call(env.merge!(k.app_defaults)) - return :delete if env.include?(RACK_HIJACK_IO) + return :ignore if env.include?(RACK_HIJACK_IO) - # this returns :wait_readable, :wait_writable, :delete, or nil: + # this returns :wait_readable, :wait_writable, :ignore, or nil: http_response_write(*response) end 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) diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb index c9febc4..5cb455b 100644 --- a/lib/yahns/queue_epoll.rb +++ b/lib/yahns/queue_epoll.rb @@ -35,9 +35,8 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc: epoll_ctl(Epoll::CTL_MOD, io, QEV_WR) when :wait_readwrite epoll_ctl(Epoll::CTL_MOD, io, QEV_RDWR) - when :delete # only used by rack.hijack - epoll_ctl(Epoll::CTL_DEL, io, 0) - @fdmap.delete(io) + when :ignore # only used by rack.hijack + @fdmap.decr when nil # this is be the ONLY place where we call IO#close on # things inside the queue diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb index e621311..20f6e18 100644 --- a/lib/yahns/wbuf_common.rb +++ b/lib/yahns/wbuf_common.rb @@ -24,7 +24,7 @@ module Yahns::WbufCommon # :nodoc: @body.close if @body.respond_to?(:close) if @wbuf_persist.respond_to?(:call) # hijack @wbuf_persist.call(client) - :delete + :ignore else @wbuf_persist # true or false or Yahns::StreamFile end |