aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 18:51:26 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 18:51:26 +0000
commit54dabd05e67ed4db1370757efe7610a783852976 (patch)
treebcb6e024c037c30f3864e06a6faac7a414a8e7f6 /railties
parentfdc4d1bd79bb31189c448acc291c942c44237c61 (diff)
downloadrails-54dabd05e67ed4db1370757efe7610a783852976.tar.gz
rails-54dabd05e67ed4db1370757efe7610a783852976.tar.bz2
rails-54dabd05e67ed4db1370757efe7610a783852976.zip
Added collusion handling for FCGI
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@134 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/environments/development.rb2
-rwxr-xr-xrailties/lib/breakpoint.rb32
2 files changed, 20 insertions, 14 deletions
diff --git a/railties/environments/development.rb b/railties/environments/development.rb
index 007a9aa1da..54720d3c1c 100644
--- a/railties/environments/development.rb
+++ b/railties/environments/development.rb
@@ -9,4 +9,4 @@ require 'irb/completion'
# tunnel when you want to connect from a different
# computer over the internet. See the documentation of
# Breakpoint.activate_drb for how to do that.
-Breakpoint.activate_drb('druby://localhost:42531', nil) if $0.include?("dispatch") \ No newline at end of file
+Breakpoint.activate_drb('druby://l​ocalhost:42531', nil, !defined?(FastCGI)) if $0.include?("dispatch") \ No newline at end of file
diff --git a/railties/lib/breakpoint.rb b/railties/lib/breakpoint.rb
index ab8a5be5a1..d456c3daa7 100755
--- a/railties/lib/breakpoint.rb
+++ b/railties/lib/breakpoint.rb
@@ -359,11 +359,13 @@ module Breakpoint
#
# Detailed information about running DRb through firewalls is
# available at http://www.rubygarden.org/ruby?DrbTutorial
- def activate_drb(uri = 'druby://localhost:42531',
- allowed_hosts = ['localhost', '127.0.0.1', '::1'])
+ def activate_drb(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'],
+ ignore_collisions = false)
return false if @use_drb
+ uri ||= 'druby://localhost:42531'
+
if allowed_hosts then
acl = ["deny", "all"]
@@ -380,17 +382,21 @@ module Breakpoint
begin
DRb.start_service(uri, @drb_service)
rescue Errno::EADDRINUSE
- # The port is already occupied by another
- # Breakpoint service. We will try to tell
- # the old service that we want its port.
- # It will then forward that request to the
- # user and retry.
- unless did_collision then
- DRbObject.new(nil, uri).collision
- did_collision = true
+ if ignore_collisions then
+ nil
+ else
+ # The port is already occupied by another
+ # Breakpoint service. We will try to tell
+ # the old service that we want its port.
+ # It will then forward that request to the
+ # user and retry.
+ unless did_collision then
+ DRbObject.new(nil, uri).collision
+ did_collision = true
+ end
+ sleep(10)
+ retry
end
- sleep(10)
- retry
end
return true
@@ -509,4 +515,4 @@ def assert(&block)
Binding.of_caller do |context|
Breakpoint.assert(context, &block)
end
-end
+end \ No newline at end of file