about summary refs log tree commit homepage
path: root/lib/mogilefs/socket_common.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mogilefs/socket_common.rb')
-rw-r--r--lib/mogilefs/socket_common.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/mogilefs/socket_common.rb b/lib/mogilefs/socket_common.rb
index d430068..886c738 100644
--- a/lib/mogilefs/socket_common.rb
+++ b/lib/mogilefs/socket_common.rb
@@ -23,18 +23,17 @@ module MogileFS::SocketCommon
      "request truncated (sent #{written} expected #{expect} timeout=#{timeout})"
   end
 
-  SEP_RE = /\A(.*?#{Regexp.escape("\n")})/
   def timed_gets(timeout = 5)
     unless defined?(@rbuf) && @rbuf
       @rbuf = timed_read(1024, "", timeout) or return # EOF
     end
     begin
-      @rbuf.sub!(SEP_RE, "") and return $1
+      @rbuf.sub!(/\A(.*\n)/o, "".freeze) and return $1
       tmp ||= ""
       if timed_read(1024, tmp, timeout)
         @rbuf << tmp
       else
-        # EOF, return the last buffered bit even without SEP_RE matching
+        # EOF, return the last buffered bit even without separatar matching
         # (not ideal for MogileFS, this is an error)
         return @rbuf.empty? ? nil : @rbuf.slice!(0, @rbuf.size)
       end