Permalink
Browse files

Custom #gets is not immune to timeouts

  • Loading branch information...
1 parent 742a390 commit 0271777be6e2f82ccf07d0e476bec6870ae8b6df @pietern pietern committed Mar 13, 2012
Showing with 3 additions and 7 deletions.
  1. +3 −7 lib/redis/connection/ruby.rb
@@ -197,13 +197,9 @@ def write(command)
end
def read
- # We read the first byte using read() mainly because gets() is
- # immune to raw socket timeouts.
- reply_type = @sock.read(1)
-
- raise Errno::ECONNRESET unless reply_type
-
- format_reply(reply_type, @sock.gets)
+ line = @sock.gets
+ reply_type = line.slice!(0, 1)
+ format_reply(reply_type, line)
rescue Errno::EAGAIN
raise TimeoutError

0 comments on commit 0271777

Please sign in to comment.