Permalink
Browse files

Added 'port open?' check to the spawner when running in repeat mode s…

…o we don't needlessly boot the dispatcher if the port is already in use anyway #4089 [guy.naor@famundo.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3938 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Mar 18, 2006
1 parent 3dc7f76 commit 8bf987140a40a523a34bb6a52dd23afb99f92331
Showing with 15 additions and 3 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +13 −3 railties/lib/commands/process/spawner.rb
@@ -1,5 +1,7 @@
*SVN*
* Added 'port open?' check to the spawner when running in repeat mode so we don't needlessly boot the dispatcher if the port is already in use anyway #4089 [guy.naor@famundo.com]
* Add verification to generated scaffolds, don't allow get for unsafe actions [Michael Koziarski]
* Don't replace application.js in public/javascripts if it already exists [Cody Fauser]
@@ -1,10 +1,20 @@
require 'optparse'
require 'socket'
def spawn(port)
puts "Starting FCGI on port: #{port}"
system("#{OPTIONS[:spawner]} -f #{OPTIONS[:dispatcher]} -p #{port}")
print "Checking if something is already running on port #{port}..."
begin
srv = TCPServer.new('0.0.0.0', port)
srv.close
srv = nil
print "NO\n "
print "Starting FCGI on port: #{port}\n "
system("#{OPTIONS[:spawner]} -f #{OPTIONS[:dispatcher]} -p #{port}")
rescue
print "YES\n"
end
end
def spawn_all
OPTIONS[:instances].times { |i| spawn(OPTIONS[:port] + i) }
end

0 comments on commit 8bf9871

Please sign in to comment.