about summary refs log tree commit homepage
path: root/lib/rainbows/revactor.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-04 08:13:24 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-04 08:13:24 +0000
commita5dc800d2e4b3a86466a03f45f64b97d29e4b11e (patch)
tree030b6af62b9d9c68868565937415f45f37ee0ecd /lib/rainbows/revactor.rb
parente867a6d1a612baf7975b14f9bffa14ea8b05f35c (diff)
downloadrainbows-a5dc800d2e4b3a86466a03f45f64b97d29e4b11e.tar.gz
While we're at it, fix a comment, too.
Diffstat (limited to 'lib/rainbows/revactor.rb')
-rw-r--r--lib/rainbows/revactor.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index 021fc48..7a063ab 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -147,7 +147,8 @@ module Rainbows::Revactor
     # Revactor socket reads always return an unspecified amount,
     # sometimes too much
     def readpartial(length, dst = "")
-      return dst if length == 0
+      return dst.replace("") if length == 0
+
       # always check and return from the userspace buffer first
       rbuf.size > 0 and return dst.replace(rbuf.read(length))
 
@@ -158,7 +159,7 @@ module Rainbows::Revactor
       # to avoid needlessly wasting memory bandwidth
       tmp.size <= length and return dst.replace(tmp)
 
-      # ugh, read returned too much, copy + reread to avoid slicing
+      # ugh, read returned too much
       rbuf << tmp[length, tmp.size]
       dst.replace(tmp[0, length])
     end