mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added collusion handling for FCGI
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@134 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
fdc4d1bd79
commit
54dabd05e6
2 changed files with 20 additions and 14 deletions
|
@ -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")
|
||||
Breakpoint.activate_drb('druby://localhost:42531', nil, !defined?(FastCGI)) if $0.include?("dispatch")
|
|
@ -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,6 +382,9 @@ module Breakpoint
|
|||
begin
|
||||
DRb.start_service(uri, @drb_service)
|
||||
rescue Errno::EADDRINUSE
|
||||
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.
|
||||
|
@ -392,6 +397,7 @@ module Breakpoint
|
|||
sleep(10)
|
||||
retry
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue