lib/moped/connection.rb in moped-1.2.7 vs lib/moped/connection.rb in moped-1.2.8

- old
+ new

@@ -83,10 +83,14 @@ # # @since 1.0.0 def read with_connection do |socket| reply = Protocol::Reply.allocate - response = socket.read(36).unpack('l<5q<l<2') + data = socket.read(36) + unless data + raise Errors::ConnectionFailure, "Attempted read from socket which returned no data." + end + response = data.unpack('l<5q<l<2') reply.length, reply.request_id, reply.response_to, reply.op_code, reply.flags,