module PryRemoteEm::Client::Broker

Public Instance Methods

log() click to toggle source
# File lib/pry-remote-em/client/broker.rb, line 9
def log
  return opts[:logger] if opts[:logger]
  @log ||= Logger.new(STDERR)
end
receive_banner(name, version, scheme) click to toggle source
# File lib/pry-remote-em/client/broker.rb, line 14
def receive_banner(name, version, scheme)
  if super(name, version, scheme)
    @opts[:tls] ? start_tls : succeed(self)
  end
end
ssl_handshake_completed() click to toggle source
# File lib/pry-remote-em/client/broker.rb, line 20
def ssl_handshake_completed
  succeed(self)
end
unbind() click to toggle source
# File lib/pry-remote-em/client/broker.rb, line 24
def unbind
  return if EventMachine.stopping?

  # Give the existing broker a little time to release the port. Even if the
  # restart here fails the next time a server tries to register, a new client
  # will be created; when that fails Broker#restart will be called again.
  timeout = ENV['PRYEMBROKERTIMEOUT'].nil? || ENV['PRYEMBROKERTIMEOUT'].empty? ? RECONNECT_TO_BROKER_TIMEOUT : ENV['PRYEMBROKERTIMEOUT']
  log.info("[pry-remote-em broker-client] broker connection unbound; starting a new one in a #{timeout} seconds")
  EM::Timer.new(timeout) do
    PryRemoteEm::Broker.restart
  end
end