diff options
-rw-r--r-- | lib/yahns/wbuf_lite.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/yahns/wbuf_lite.rb b/lib/yahns/wbuf_lite.rb index 577b4dc..7d77da9 100644 --- a/lib/yahns/wbuf_lite.rb +++ b/lib/yahns/wbuf_lite.rb @@ -46,14 +46,13 @@ class Yahns::WbufLite # :nodoc: @busy = rv return rv else - raise "BUG: #{rv.nil? ? 'EOF' : rv.inspect} on " + 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 # we're all caught up, try to save some memory if we can help it. wbuf_abort - @sf_offset = 0 @busy = false nil rescue @@ -69,7 +68,7 @@ class Yahns::WbufLite # :nodoc: when :wait_writable, :wait_readable return rv else - raise "BUG: #{rv.nil? ? 'EOF' : rv.inspect} on " + 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 @@ -83,7 +82,7 @@ class Yahns::WbufLite # :nodoc: # called by Yahns::HttpClient#step_write def wbuf_close(client) - wbuf_abort + wbuf_abort if @tmpio # resume the event loop when @blocked is empty # The actual Yahns::ReqRes#yahns_step is actually read/write-event @@ -102,12 +101,10 @@ class Yahns::WbufLite # :nodoc: end def wbuf_abort + @sf_offset = @sf_count = 0 # we can safely truncate since this is a StringIO, we cannot do this # with a real file because zero-copy with sendfile means truncating # a while could clobber in-flight data - if @tmpio - @tmpio.truncate(0) - @tmpio = @tmpio.close - end + @tmpio.truncate(0) end end |