From fdc4d1bd79bb31189c448acc291c942c44237c61 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Dec 2004 18:22:12 +0000 Subject: Added confirmations on successfull connections and resumations git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@133 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/breakpoint_client.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/breakpoint_client.rb b/railties/lib/breakpoint_client.rb index d36b347d46..bdcad4cf3b 100644 --- a/railties/lib/breakpoint_client.rb +++ b/railties/lib/breakpoint_client.rb @@ -1,5 +1,6 @@ require 'breakpoint' require 'optparse' +require 'timeout' options = { :ClientURI => nil, @@ -60,6 +61,19 @@ DRb.start_service(options[:ClientURI]) begin service = DRbObject.new(nil, options[:ServerURI]) + begin + timeout(10) { service.ping } + rescue Timeout::Error, DRb::DRbConnError + puts "", + " *** Breakpoint service didn't respond to ping request ***", + " This likely happened because of a misconfigured ACL (see the", + " documentation of Breakpoint.activate_drb, note that by default", + " you can only connect to a remote Breakpoint service via a SSH", + " tunnel), but might also be caused by an extremely slow connection.", + "" + raise + end + begin service.register_eval_handler do |code| result = eval(code, TOPLEVEL_BINDING) @@ -105,8 +119,11 @@ begin service.register_handler do |workspace, message| puts message IRB.start(nil, nil, workspace) + puts "", "Resumed execution. Waiting for next breakpoint...", "" end + puts "Connection established. Waiting for breakpoint...", "" + loop do begin service.ping @@ -123,12 +140,13 @@ begin rescue Exception => error if options[:RetryDelay] > 0 then puts "No connection to breakpoint service at #{options[:ServerURI]}:", - " (#{error})", - " Reconnecting in #{options[:RetryDelay]} seconds..." + " (#{error.inspect})" + puts error.backtrace if $DEBUG + puts " Reconnecting in #{options[:RetryDelay]} seconds..." sleep options[:RetryDelay] retry else raise end -end +end \ No newline at end of file -- cgit v1.2.3