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"]
Array(allowed_hosts).each do |host|
acl += ["allow", host]
end
DRb.install_acl(ACL.new(acl))
end
@use_drb = true
@drb_service = DRbService.new
did_collision = false
begin
@service = DRb.start_service(uri, @drb_service)
rescue Errno::EADDRINUSE
if ignore_collisions then
nil
else
unless did_collision then
DRbObject.new(nil, uri).collision
did_collision = true
end
sleep(10)
retry
end
end
return true
end