everything related to duct tape audio suite (dtas)
 help / color / Atom feed
* [PATCH] favor recv and recv_nonblock over recvmsg variants
@ 2015-06-16  0:36 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-06-16  0:36 UTC (permalink / raw)
  To: dtas-all; +Cc: Eric Wong

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16  0:36 [PATCH] favor recv and recv_nonblock over recvmsg variants Eric Wong

everything related to duct tape audio suite (dtas)

Archives are clonable:
	git clone --mirror https://80x24.org/dtas-all
	git clone --mirror http://ou63pmih66umazou.onion/dtas-all

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.dtas
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git