lib/aerospike/socket/base.rb in aerospike-2.13.0 vs lib/aerospike/socket/base.rb in aerospike-2.14.0

- old
+ new

@@ -23,16 +23,17 @@ def initialize(*args) super(*args) @timeout = nil end - def read(buffer, length) + def read(buffer, length, offset = 0) bytes_read = 0 until bytes_read >= length result = read_from_socket(length - bytes_read) - buffer.write_binary(result, bytes_read) + buffer.write_binary(result, offset + bytes_read) bytes_read += result.bytesize end + bytes_read end def read_from_socket(length) with_timeout(@timeout) do read_nonblock(length) \ No newline at end of file