about summary refs log tree commit homepage
path: root/lib/dtas/buffer
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-06 23:15:36 +0000
committerEric Wong <e@80x24.org>2015-09-06 23:16:43 +0000
commit856b1c7064155e59c84942a7e8cd36128b6be34e (patch)
treec45027bedec2caa280c26c815f45a8f4d1b8a120 /lib/dtas/buffer
parentc3bb7810709a99a9886c7f96aed6fa62690a12cb (diff)
downloaddtas-856b1c7064155e59c84942a7e8cd36128b6be34e.tar.gz
This allows us to avoid wasting time reopening the same
device over and over again.
Diffstat (limited to 'lib/dtas/buffer')
-rw-r--r--lib/dtas/buffer/splice.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/dtas/buffer/splice.rb b/lib/dtas/buffer/splice.rb
index 02ce877..be40881 100644
--- a/lib/dtas/buffer/splice.rb
+++ b/lib/dtas/buffer/splice.rb
@@ -10,7 +10,6 @@ module DTAS::Buffer::Splice # :nodoc:
   MAX_AT_ONCE = 4096 # page size in Linux
   MAX_AT_ONCE_1 = 65536
   MAX_SIZE = File.read("/proc/sys/fs/pipe-max-size").to_i
-  DEVNULL = File.open("/dev/null", "r+")
   F_MOVE = IO::Splice::F_MOVE
 
   def buffer_size
@@ -25,7 +24,7 @@ module DTAS::Buffer::Splice # :nodoc:
 
   # be sure to only call this with nil when all writers to @wr are done
   def discard(bytes)
-    IO.splice(@to_io, nil, DEVNULL, nil, bytes)
+    IO.splice(@to_io, nil, DTAS.null, nil, bytes)
   end
 
   def broadcast_one(targets, limit = nil)