aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 18:22:12 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 18:22:12 +0000
commitfdc4d1bd79bb31189c448acc291c942c44237c61 (patch)
treef79570ecf0e220b4d06f4cb919035586922587ea /railties
parent5c50df27cf1a81cd8ace5cad83bc7acee61311da (diff)
downloadrails-fdc4d1bd79bb31189c448acc291c942c44237c61.tar.gz
rails-fdc4d1bd79bb31189c448acc291c942c44237c61.tar.bz2
rails-fdc4d1bd79bb31189c448acc291c942c44237c61.zip
Added confirmations on successfull connections and resumations
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@133 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/breakpoint_client.rb24
1 files changed, 21 insertions, 3 deletions
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,
@@ -61,6 +62,19 @@ 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)
result.extend(DRb::DRbUndumped) rescue nil
@@ -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