about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-12-04 22:39:07 +0000
committerEric Wong <normalperson@yhbt.net>2011-12-04 22:39:07 +0000
commit62d9c8ea87dbd34eeaad211586015d879636eb0b (patch)
tree3a3f9aa166ec2bd8002fd2a20de237961ef69566
parenta12bf1bb1e5b39f2b416f049c5503fa305f6f65a (diff)
downloadmogilefs-client-checksums.tar.gz
Minor cleanup, one less un-optimized method dispatch.
-rw-r--r--lib/mogilefs/socket_common.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mogilefs/socket_common.rb b/lib/mogilefs/socket_common.rb
index 298e3da..404acd0 100644
--- a/lib/mogilefs/socket_common.rb
+++ b/lib/mogilefs/socket_common.rb
@@ -43,9 +43,9 @@ module MogileFS::SocketCommon
   def read(size, buf = "", timeout = 5)
     timed_read(size, buf, timeout) or return # nil/EOF
 
-    while size > buf.bytesize
+    while (size -= buf.bytesize) > 0
       tmp ||= ""
-      timed_read(size - buf.bytesize, tmp, timeout) or return buf # truncated
+      timed_read(size, tmp, timeout) or return buf # truncated
       buf << tmp
     end