diff options
author | Johan Sørensen <johan@johansorensen.com> | 2008-04-15 23:11:27 +0200 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2008-04-15 23:17:58 +0200 |
commit | cdf2711b5d3fda110574a98425a82d410d97f68a (patch) | |
tree | 958aa66dec4dee575dbf50c01c85b0c721a1fab3 /script/git-daemon | |
parent | 9b16bb7603e1fff6b2ca4ecea0907b824bd7f0f9 (diff) | |
download | gitorious-mainline-outdated-cdf2711b5d3fda110574a98425a82d410d97f68a.zip gitorious-mainline-outdated-cdf2711b5d3fda110574a98425a82d410d97f68a.tar.gz gitorious-mainline-outdated-cdf2711b5d3fda110574a98425a82d410d97f68a.tar.bz2 |
decrease the active children count when closing sockets before the fork,
and some de-tabification
Diffstat (limited to 'script/git-daemon')
-rwxr-xr-x | script/git-daemon | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/script/git-daemon b/script/git-daemon index 2821d12..a871e86 100755 --- a/script/git-daemon +++ b/script/git-daemon @@ -44,7 +44,10 @@ class Daemon $children_active += 1 if $children_active - $children_reaped > MAX_CHILDREN + log(Process.pid, "too many active children #{$children_active - $children_reaped}/#{MAX_CHILDREN}") session.close + # we didn't actually do the fork, so decrease the count + $children_active -= 1 next end @@ -57,14 +60,16 @@ class Daemon host = $4 path = "#{BASE_PATH}/#{base_path}" - if !File.join(File.expand_path(path)).index(BASE_PATH) == 0 || !File.directory?(path) + if !File.join(File.expand_path(path)).index(BASE_PATH) == 0 || !File.directory?(path) log(Process.pid, "Invalid path: #{base_path}") session.close + $children_active -= 1 next end if !File.exist?(File.join(path, "git-daemon-export-ok")) session.close + $children_active -= 1 next end @@ -87,18 +92,18 @@ class Daemon session.close if repository - if ip_family == "AF_INET6" - repository.cloned_from(ip) - else - localization = @geoip.country(ip) - repository.cloned_from(ip, localization[3], localization[5]) - end + if ip_family == "AF_INET6" + repository.cloned_from(ip) + else + localization = @geoip.country(ip) + repository.cloned_from(ip, localization[3], localization[5]) + end else log(pid, "Cannot find repository: #{path}") end exec(cmd) - + $children_reaped += 1 exit! end end |