diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-04 08:13:24 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-04 08:13:24 +0000 |
commit | a5dc800d2e4b3a86466a03f45f64b97d29e4b11e (patch) | |
tree | 030b6af62b9d9c68868565937415f45f37ee0ecd /lib | |
parent | e867a6d1a612baf7975b14f9bffa14ea8b05f35c (diff) | |
download | rainbows-a5dc800d2e4b3a86466a03f45f64b97d29e4b11e.tar.gz |
While we're at it, fix a comment, too.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rainbows/revactor.rb | 5 |
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 |