Permalink
Browse files

Added confirmations on successfull connections and resumations

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@133 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 5c50df2 commit fdc4d1bd79bb31189c448acc291c942c44237c61 @dhh dhh committed Dec 12, 2004
Showing with 21 additions and 3 deletions.
  1. +21 −3 railties/lib/breakpoint_client.rb
@@ -1,5 +1,6 @@
require 'breakpoint'
require 'optparse'
+require 'timeout'
options = {
:ClientURI => nil,
@@ -61,6 +62,19 @@
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 @@
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 @@
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

0 comments on commit fdc4d1b

Please sign in to comment.