about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/wbuf.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/yahns/wbuf.rb b/lib/yahns/wbuf.rb
index df7d56d..10312db 100644
--- a/lib/yahns/wbuf.rb
+++ b/lib/yahns/wbuf.rb
@@ -37,6 +37,11 @@ class Yahns::Wbuf # :nodoc:
       raise "BUG: #{rv.nil ? "EOF" : rv.inspect} on tmpio " \
             "sf_offset=#@sf_offset sf_count=#@sf_count"
     end while @sf_count > 0
+
+    # we're all caught up, try to prevent dirty data from getting flushed
+    # to disk if we can help it.
+    @tmpio.truncate(@sf_offset = 0)
+    @tmpio.rewind
     nil
   end