Commit 73d50927c92e763da5ba6cf8a7f1a7654a7267bb

beware of the geoip io stream when forking

Commit diff

script/git-daemon

 
2727
2828 def initialize(options)
2929 @options = options
30 @geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat"))
3130 end
3231
3332 def start
5656
5757 def run_service(session)
5858 $children_active += 1
59 ip_family, port, name, ip = session.peeraddr
5960
6061 line = session.recv(1000)
6162
9494 end
9595
9696 pid = Process.pid
97 ip_family, port, name, ip = session.peeraddr
9897 log(pid, "Connection from #{ip} for #{path.inspect}")
9998
10099 $stdout.reopen(session)
104104 if ip_family == "AF_INET6"
105105 repository.cloned_from(ip)
106106 else
107 localization = @geoip.country(ip)
107 geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat"))
108 localization = geoip.country(ip)
108109 repository.cloned_from(ip, localization[3], localization[5])
109110 end
110111 else
120120 end
121121 end rescue Errno::EAGAIN
122122 else
123 $stderr.puts "Invalid request: #{line}"
123 $stderr.puts "Invalid request from #{ip}: #{line}"
124124 session.close
125125 $children_active -= 1
126126 end
toggle raw diff