Class: JRPC::SharedClient::TransportLoop
- Inherits:
-
Object
- Object
- JRPC::SharedClient::TransportLoop
- Includes:
- PayloadLogging
- Defined in:
- lib/jrpc/shared_client/transport_loop.rb
Constant Summary collapse
- SELECT_FLOOR =
60.0
Constants included from PayloadLogging
PayloadLogging::RECV_MARK, PayloadLogging::SEND_MARK
Instance Method Summary collapse
-
#initialize(transport:, registry:, outbound_queue:, wake_pipe_reader:, write_timeout:, reap_timeout:, logger:, shutdown_check:, clock: nil) ⇒ TransportLoop
constructor
A new instance of TransportLoop.
-
#run ⇒ Object
Runs the transport loop.
Methods included from PayloadLogging
Constructor Details
#initialize(transport:, registry:, outbound_queue:, wake_pipe_reader:, write_timeout:, reap_timeout:, logger:, shutdown_check:, clock: nil) ⇒ TransportLoop
Returns a new instance of TransportLoop.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jrpc/shared_client/transport_loop.rb', line 10 def initialize( transport:, registry:, outbound_queue:, wake_pipe_reader:, write_timeout:, reap_timeout:, logger:, shutdown_check:, clock: nil ) @transport = transport @registry = registry @outbound_queue = outbound_queue @wake_pipe_reader = wake_pipe_reader @write_timeout = write_timeout @reap_timeout = reap_timeout @logger = logger @shutdown_check = shutdown_check @clock = clock || method(:default_clock) @last_rx_at = nil end |
Instance Method Details
#run ⇒ Object
Runs the transport loop. Calls on_crash.(err) on unexpected exception, then returns.
29 30 31 32 33 34 35 |
# File 'lib/jrpc/shared_client/transport_loop.rb', line 29 def run(&) main_loop rescue StandardError => e log_error("transport thread crashed: #{e.class}: #{e.}\n#{e.backtrace.join("\n")}") err = Errors::ConnectionError.new("transport thread crashed: #{e.class}: #{e.}") yield(err) end |