about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-12-06 20:54:09 +0000
committerEric Wong <normalperson@yhbt.net>2011-12-06 12:55:26 -0800
commit9ef18521688bb008e173bfcca57f4abcd012205f (patch)
treeedc7c883205092ad4fadfbd9386eb5323246c69e
parentbafa6f41dbfda371e248656e50441bc7f6503826 (diff)
downloadmogilefs-client-9ef18521688bb008e173bfcca57f4abcd012205f.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