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: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 9C6DA633803 for ; Tue, 16 Jun 2015 00:37:14 +0000 (UTC) Received: from localhost ([::1]:36999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4esL-0000gh-Ti for dtas-all@80x24.org; Mon, 15 Jun 2015 20:37:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4esK-0000gc-5i for dtas-all@nongnu.org; Mon, 15 Jun 2015 20:37:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4esG-0002HE-Vt for dtas-all@nongnu.org; Mon, 15 Jun 2015 20:37:12 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:54836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4esG-0002H1-Q3 for dtas-all@nongnu.org; Mon, 15 Jun 2015 20:37:08 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 642A1633802; Tue, 16 Jun 2015 00:37:07 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] favor recv and recv_nonblock over recvmsg variants Date: Tue, 16 Jun 2015 00:36:51 +0000 Message-Id: <1434415011-23055-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: Eric Wong X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org We never use the full return value of the recvmsg* methods, so those allocations are wasted. --- lib/dtas/unix_accepted.rb | 2 +- lib/dtas/unix_client.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dtas/unix_accepted.rb b/lib/dtas/unix_accepted.rb index c08d431..a0000cf 100644 --- a/lib/dtas/unix_accepted.rb +++ b/lib/dtas/unix_accepted.rb @@ -56,7 +56,7 @@ class DTAS::UNIXAccepted # :nodoc: begin begin - msg, _, _ = io.recvmsg_nonblock(nread, 0, 0) + msg = io.recv_nonblock(nread) rescue Errno::EAGAIN return :wait_readable rescue EOFError, SystemCallError diff --git a/lib/dtas/unix_client.rb b/lib/dtas/unix_client.rb index fbb1510..2c8ba43 100644 --- a/lib/dtas/unix_client.rb +++ b/lib/dtas/unix_client.rb @@ -41,6 +41,6 @@ class DTAS::UNIXClient # :nodoc: IO.select([@to_io], nil, nil, timeout) nr = @to_io.nread nr > 0 or raise EOFError, "unexpected EOF from server" - @to_io.recvmsg(nr, 0, 0)[0] + @to_io.recv(nr) end end -- EW