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) ⇒ Dialer
constructor
A new instance of Dialer.
- #wrap_connection(conn) ⇒ Object
Constructor Details
#initialize(endpoint, engine, dict_bytes) ⇒ Dialer
Returns a new instance of Dialer.
121 122 123 124 125 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 121 def initialize(endpoint, engine, dict_bytes) @endpoint = endpoint @engine = engine @dict_bytes = dict_bytes end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
119 120 121 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 119 def endpoint @endpoint end |
Instance Method Details
#connect ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 128 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
142 143 144 145 146 147 148 |
# File 'lib/omq/transport/lz4_tcp/transport.rb', line 142 def wrap_connection(conn) Lz4Connection.new( conn, send_dict_bytes: @dict_bytes, max_message_size: @engine.., ) end |