lib/redis/connection/synchrony.rb in redis-3.0.1 vs lib/redis/connection/synchrony.rb in redis-3.0.2
- old
+ new
@@ -25,16 +25,21 @@
end
def receive_data(data)
@reader.feed(data)
- begin
- until (reply = @reader.gets) == false
- reply = CommandError.new(reply.message) if reply.is_a?(RuntimeError)
- @req.succeed [:reply, reply]
+ loop do
+ begin
+ reply = @reader.gets
+ rescue RuntimeError => err
+ @req.fail [:error, ProtocolError.new(err.message)]
+ break
end
- rescue RuntimeError => err
- @req.fail [:error, ProtocolError.new(err.message)]
+
+ break if reply == false
+
+ reply = CommandError.new(reply.message) if reply.is_a?(RuntimeError)
+ @req.succeed [:reply, reply]
end
end
def read
@req = EventMachine::DefaultDeferrable.new