Sha256: 27264529b37051fb91e974b3fb45ad87c6e449b4b226630dc421e2b2ab276e7a
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
require 'monitor' module Fastdfs module Client class ClientProxy include MonitorMixin attr_accessor :host, :port, :socket def initialize(host, port, options = {}) super() options ||= {} @host = host @port = port @socket = Socket.new(host, port, options[:socket]) end def dispose(cmd, content_len, header = [], content = [], &block) synchronize do @socket.connection do full_header = ProtoCommon.header_bytes(cmd, content_len) + header @socket.write(cmd, full_header) Array(content).each do |c| @socket.write(cmd, c) end @socket.receive &block end end ensure @socket.close end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fastdfs-client-1.3.0 | lib/fastdfs-client/client_proxy.rb |