Class: MessagePack::RPC::UNIXClientTransport

Inherits:
Object
  • Object
show all
Defined in:
lib/msgpack/rpc/transport/unix.rb

Defined Under Namespace

Classes: ClientSocket

Instance Method Summary collapse

Constructor Details

#initialize(session, address) ⇒ UNIXClientTransport

Returns a new instance of UNIXClientTransport.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/msgpack/rpc/transport/unix.rb', line 59

def initialize(session, address)
  io = UNIXSocket.new(address)

  begin
    @sock = ClientSocket.new(io, session)
  rescue
    io.close
    raise
  end

  begin
    session.loop.attach(@sock)
  rescue
    @sock.close
    raise
  end
end

Instance Method Details

#closeObject

ClientTransport interface



83
84
85
86
# File 'lib/msgpack/rpc/transport/unix.rb', line 83

def close
  @sock.detach if @sock.attached?
  @sock.close
end

#send_data(data) ⇒ Object

ClientTransport interface



78
79
80
# File 'lib/msgpack/rpc/transport/unix.rb', line 78

def send_data(data)
  @sock.send_data(data)
end