diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/yahns/wbuf.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/yahns/wbuf.rb b/lib/yahns/wbuf.rb index 42776cf..9888a8c 100644 --- a/lib/yahns/wbuf.rb +++ b/lib/yahns/wbuf.rb @@ -41,6 +41,11 @@ class Yahns::Wbuf # :nodoc: @busy = busy # may be false end + def wbuf_writev(buf) + @tmpio.kgio_writev(buf) + buf.inject(0) { |n, s| n += s.size } + end + def wbuf_write(c, buf) # try to bypass the VFS layer and write directly to the socket # if we're all caught up @@ -54,7 +59,7 @@ class Yahns::Wbuf # :nodoc: end until @busy @tmpio ||= Yahns::TmpIO.new(@tmpdir) - @sf_count += String === buf ? @tmpio.write(buf) : @tmpio.kgio_writev(buf) + @sf_count += String === buf ? @tmpio.write(buf) : wbuf_writev(buf) # we spent some time copying to the FS, try to write to # the socket again in case some space opened up... |