diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-03-09 16:20:27 +0100 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2009-04-22 15:16:07 +0200 |
commit | c6c6cfe4961a821846e4c912baffe9c7c2cb0c12 (patch) | |
tree | cf2f618b06b37e500b7985401b205a27b6a8c252 /script/git-daemon | |
parent | ef32932e479717b47bf82da864f47b16c088ceac (diff) | |
download | gitorious-mainline-outdated-c6c6cfe4961a821846e4c912baffe9c7c2cb0c12.zip gitorious-mainline-outdated-c6c6cfe4961a821846e4c912baffe9c7c2cb0c12.tar.gz gitorious-mainline-outdated-c6c6cfe4961a821846e4c912baffe9c7c2cb0c12.tar.bz2 |
Set SO_REUSEADDR in the git-daemon on by default
Diffstat (limited to 'script/git-daemon')
-rwxr-xr-x | script/git-daemon | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/script/git-daemon b/script/git-daemon index b620cfc..7275f08 100755 --- a/script/git-daemon +++ b/script/git-daemon @@ -40,6 +40,7 @@ module Git end end @socket = TCPServer.new(@options[:host], @options[:port]) + @socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, !!@options[:reuseaddr]) @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) log(Process.pid, "Listening on #{@options[:host]}:#{@options[:port]}...") ActiveRecord::Base.verify_active_connections! if @options[:daemonize] @@ -234,8 +235,8 @@ options = { :host => "0.0.0.0", :logfile => File.join(RAILS_ROOT, "log", "git-daemon.log"), :pidfile => File.join(RAILS_ROOT, "log", "git-daemon.pid"), - :daemonize => false - + :daemonize => false, + :reuseaddr => true, } OptionParser.new do |opts| @@ -261,6 +262,10 @@ OptionParser.new do |opts| options[:daemonize] = o end + opts.on("-r", "--reuseaddr", "Re-use addresses", "Default: #{options[:reuseaddr].inspect}") do |o| + options[:reuseaddr] = o + end + opts.on_tail("-h", "--help", "Show this help message.") do puts opts exit |