From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 177092034E for ; Tue, 19 Jul 2016 22:24:43 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH 2/2] wbuf_lite: unify EOF error handling Date: Tue, 19 Jul 2016 22:24:37 +0000 Message-Id: <20160719222437.23103-3-e@80x24.org> In-Reply-To: <20160719222437.23103-1-e@80x24.org> References: <20160719222437.23103-1-e@80x24.org> List-Id: 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(-) 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 @@ def wbuf_flush(client) @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) -- EW