From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS43350 77.247.176.0/21 X-Spam-Status: No, score=-2.1 required=3.0 tests=AWL,BAYES_00,RCVD_IN_XBL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: spew@80x24.org Received: from 80x24.org (politkovskaja.torservers.net [77.247.181.165]) by dcvr.yhbt.net (Postfix) with ESMTP id 5DF80200CA for ; Tue, 7 Apr 2015 21:52:05 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] wbuf: fix writev Date: Tue, 7 Apr 2015 21:52:02 +0000 Message-Id: <1428443522-5828-1-git-send-email-e@80x24.org> List-Id: --- lib/yahns/wbuf.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/yahns/wbuf.rb b/lib/yahns/wbuf.rb index 42776cf..a04565e 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 + @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... -- EW