Class: OMQ::Transport::IPC::Dialer
- Inherits:
-
Object
- Object
- OMQ::Transport::IPC::Dialer
- Defined in:
- lib/omq/transport/ipc.rb
Overview
An IPC dialer — stateful factory for outgoing connections.
Instance Attribute Summary collapse
-
#endpoint ⇒ String
readonly
The endpoint this dialer connects to.
Instance Method Summary collapse
-
#connect ⇒ void
Establishes a Unix socket connection to the endpoint.
-
#initialize(endpoint, engine) ⇒ Dialer
constructor
A new instance of Dialer.
Constructor Details
#initialize(endpoint, engine) ⇒ Dialer
Returns a new instance of Dialer.
102 103 104 105 |
# File 'lib/omq/transport/ipc.rb', line 102 def initialize(endpoint, engine) @endpoint = endpoint @engine = engine end |
Instance Attribute Details
#endpoint ⇒ String (readonly)
Returns the endpoint this dialer connects to.
96 97 98 |
# File 'lib/omq/transport/ipc.rb', line 96 def endpoint @endpoint end |
Instance Method Details
#connect ⇒ void
This method returns an undefined value.
Establishes a Unix socket connection to the endpoint.
112 113 114 115 116 117 118 |
# File 'lib/omq/transport/ipc.rb', line 112 def connect path = IPC.parse_path(@endpoint) sock_path = IPC.to_socket_path(path) sock = UNIXSocket.new(sock_path) IPC.apply_buffer_sizes(sock, @engine.) @engine.handle_connected(IO::Stream::Buffered.wrap(sock), endpoint: @endpoint) end |