From 98beb40e1fe27160ee1b3ac2c87ef3020426fd43 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 19 Jul 2016 22:09:23 +0000 Subject: wbuf_lite: unify EOF error handling StringIO can never be truncated outside our control, so it is a bug if we see EOF on trysendio, here. --- lib/yahns/wbuf_lite.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/yahns/wbuf_lite.rb b/lib/yahns/wbuf_lite.rb index 8a93ad1..577b4dc 100644 --- a/lib/yahns/wbuf_lite.rb +++ b/lib/yahns/wbuf_lite.rb @@ -68,16 +68,9 @@ class Yahns::WbufLite # :nodoc: @sf_offset += rv # keep going otherwise when :wait_writable, :wait_readable return rv - when nil - # response got truncated, drop the connection - # this may happens when using Rack::File or similar, we can't - # keep the connection alive because we already sent our Content-Length - # header the client would be confused. - @wbuf_persist = false - return wbuf_close(client) else - raise "BUG: rv=#{rv.inspect} " \ - "on tmpio=#{@tmpio.inspect} " \ + raise "BUG: #{rv.nil? ? 'EOF' : rv.inspect} on " + "tmpio.size=#{@tmpio.size} " \ "sf_offset=#@sf_offset sf_count=#@sf_count" end while @sf_count > 0 wbuf_close(client) -- cgit v1.2.3-24-ge0c7