Class: OMQ::Transport::Lz4Tcp::Dialer
- Inherits:
-
Object
- Object
- OMQ::Transport::Lz4Tcp::Dialer
- Defined in:
- lib/omq/transport/lz4_tcp/transport.rb
Overview
Dialer: outgoing connections.
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(endpoint, engine, dict_bytes, auto_dict) ⇒ Dialer
constructor
A new instance of Dialer.
- #wrap_connection(conn) ⇒ Object
Constructor Details
#initialize(endpoint, engine, dict_bytes, auto_dict) ⇒ Dialer
Returns a new instance of Dialer.
164 165 166 167 168 169 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 164 def initialize(endpoint, engine, dict_bytes, auto_dict) @endpoint = endpoint @engine = engine @dict_bytes = dict_bytes @auto_dict = auto_dict end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
162 163 164 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 162 def endpoint @endpoint end |
Instance Method Details
#connect ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 172 def connect host, port = Lz4Tcp.parse_endpoint(@endpoint) host = Lz4Tcp.normalize_connect_host(host) sock = ::Socket.tcp(host, port, connect_timeout: Lz4Tcp.connect_timeout(@engine.)) TCP.apply_buffer_sizes(sock, @engine.) @engine.handle_connected(IO::Stream::Buffered.wrap(sock), endpoint: @endpoint) rescue sock&.close raise end |
#wrap_connection(conn) ⇒ Object
186 187 188 189 190 191 192 193 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 186 def wrap_connection(conn) Lz4Connection.new( conn, send_dict_bytes: @dict_bytes, max_message_size: @engine.., auto_dict: @auto_dict, ) end |