Commit cdf2711b5d3fda110574a98425a82d410d97f68a

decrease the active children count when closing sockets before the fork,
and some de-tabification

Commit diff

script/git-daemon

 
4444 $children_active += 1
4545
4646 if $children_active - $children_reaped > MAX_CHILDREN
47 log(Process.pid, "too many active children #{$children_active - $children_reaped}/#{MAX_CHILDREN}")
4748 session.close
49 # we didn't actually do the fork, so decrease the count
50 $children_active -= 1
4851 next
4952 end
5053
6060 host = $4
6161
6262 path = "#{BASE_PATH}/#{base_path}"
63 if !File.join(File.expand_path(path)).index(BASE_PATH) == 0 || !File.directory?(path)
63 if !File.join(File.expand_path(path)).index(BASE_PATH) == 0 || !File.directory?(path)
6464 log(Process.pid, "Invalid path: #{base_path}")
6565 session.close
66 $children_active -= 1
6667 next
6768 end
6869
6970 if !File.exist?(File.join(path, "git-daemon-export-ok"))
7071 session.close
72 $children_active -= 1
7173 next
7274 end
7375
9292 session.close
9393
9494 if repository
95 if ip_family == "AF_INET6"
96 repository.cloned_from(ip)
97 else
98 localization = @geoip.country(ip)
99 repository.cloned_from(ip, localization[3], localization[5])
100 end
95 if ip_family == "AF_INET6"
96 repository.cloned_from(ip)
97 else
98 localization = @geoip.country(ip)
99 repository.cloned_from(ip, localization[3], localization[5])
100 end
101101 else
102102 log(pid, "Cannot find repository: #{path}")
103103 end
104104
105105 exec(cmd)
106
106 $children_reaped += 1
107107 exit!
108108 end
109109 end
toggle raw diff