lib/fastdfs-client/tracker.rb in fastdfs-client-1.0.2 vs lib/fastdfs-client/tracker.rb in fastdfs-client-1.2.0

- old
+ new

@@ -3,20 +3,20 @@ module Fastdfs module Client class Tracker - attr_accessor :socket, :cmd, :options + attr_accessor :socket, :cmd, :options, :socket def initialize(host, port, options = {}) @options = options - @socket = Socket.new(host, port, @options[:socket]) + @proxy = ClientProxy.new(host, port, @options[:socket]) + @socket = @proxy.socket @cmd = CMD::STORE_WITHOUT_GROUP_ONE end def get_storage - client = ClientProxy.new(@cmd, @socket, 0) - res = client.dispose do |body| + res = @proxy.dispose(@cmd, 0) do |body| storage_ip = body[ProtoCommon::IPADDR].strip storage_port = body[ProtoCommon::PORT].unpack("C*").to_pack_long store_path = body[ProtoCommon::TRACKER_BODY_LEN-1].unpack("C*")[0] Storage.new(storage_ip, storage_port, store_path, @options) \ No newline at end of file