From 0f8a3b31db6933175f4d22be9c3342cd6d9f1061 Mon Sep 17 00:00:00 2001 From: Tom Werner Date: Tue, 4 Sep 2007 13:25:09 -0700 Subject: [PATCH] use 127.0.0.1 for DRb to avoid IPv6 problems --- bin/god | 2 +- lib/god.rb | 2 +- test/configs/child_events/child_events.god | 3 ++- test/configs/daemon_events/daemon_events.god | 2 +- test/test_server.rb | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/god b/bin/god index 00942d1..0e96c9b 100755 --- a/bin/god +++ b/bin/god @@ -75,7 +75,7 @@ elsif command = ARGV[0] # connect to remote drb DRb.start_service - server = DRbObject.new nil, "druby://localhost:#{options[:port]}" + server = DRbObject.new nil, "druby://127.0.0.1:#{options[:port]}" begin server.ping diff --git a/lib/god.rb b/lib/god.rb index 06e7545..978391f 100644 --- a/lib/god.rb +++ b/lib/god.rb @@ -59,7 +59,7 @@ module God LOG_BUFFER_SIZE_DEFAULT = 100 PID_FILE_DIRECTORY_DEFAULT = '/var/run/god' DRB_PORT_DEFAULT = 17165 - DRB_ALLOW_DEFAULT = ['localhost'] + DRB_ALLOW_DEFAULT = ['127.0.0.1'] class << self # user configurable diff --git a/test/configs/child_events/child_events.god b/test/configs/child_events/child_events.god index 7ea5785..40fe148 100644 --- a/test/configs/child_events/child_events.god +++ b/test/configs/child_events/child_events.god @@ -11,11 +11,12 @@ God.watch do |w| end # determine when process has finished starting - w.transition(:start, :up) do |on| + w.transition([:start, :restart], :up) do |on| on.condition(:process_running) do |c| c.running = true end + # failsafe on.condition(:tries) do |c| c.times = 2 c.transition = :start diff --git a/test/configs/daemon_events/daemon_events.god b/test/configs/daemon_events/daemon_events.god index e9bd50f..304f5b0 100644 --- a/test/configs/daemon_events/daemon_events.god +++ b/test/configs/daemon_events/daemon_events.god @@ -15,7 +15,7 @@ God.watch do |w| end # determine when process has finished starting - w.transition(:start, :up) do |on| + w.transition([:start, :restart], :up) do |on| on.condition(:process_running) do |c| c.running = true end diff --git a/test/test_server.rb b/test/test_server.rb index 03f0ee3..e413274 100644 --- a/test/test_server.rb +++ b/test/test_server.rb @@ -38,9 +38,9 @@ class TestServer < Test::Unit::TestCase end def test_should_install_pass_through_acl - ACL.expects(:new).with(%w{deny all allow localhost allow 0.0.0.0}) + ACL.expects(:new).with(%w{deny all allow 127.0.0.1 allow 0.0.0.0}) no_stdout do - Server.new(nil, 17165, %w{localhost 0.0.0.0}) + Server.new(nil, 17165, %w{127.0.0.1 0.0.0.0}) end end -- 2.11.4.GIT