public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
Search Repo:
beware of the geoip io stream when forking
Johan Sørensen (author)
Fri Apr 18 16:52:28 -0700 2008
commit  73d50927c92e763da5ba6cf8a7f1a7654a7267bb
tree    01fcc34371a692b521729990be0783c1ae590120
parent  d3001d52b84fe0bdde5a5d9829e49f6ce54ddec6
...
27
28
29
30
31
32
33
...
57
58
59
 
60
61
62
...
94
95
96
97
98
99
100
...
105
106
107
108
 
 
109
110
111
...
120
121
122
123
 
124
125
126
...
27
28
29
 
30
31
32
...
56
57
58
59
60
61
62
...
94
95
96
 
97
98
99
...
104
105
106
 
107
108
109
110
111
...
120
121
122
 
123
124
125
126
0
@@ -27,7 +27,6 @@ module Git
0
     
0
     def initialize(options)
0
       @options = options
0
- @geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat"))
0
     end
0
     
0
     def start
0
@@ -57,6 +56,7 @@ module Git
0
     
0
     def run_service(session)
0
       $children_active += 1
0
+ ip_family, port, name, ip = session.peeraddr
0
       
0
       line = session.recv(1000)
0
       
0
@@ -94,7 +94,6 @@ module Git
0
             end
0
             
0
             pid = Process.pid
0
- ip_family, port, name, ip = session.peeraddr
0
             log(pid, "Connection from #{ip} for #{path.inspect}")
0
           
0
             $stdout.reopen(session)
0
@@ -105,7 +104,8 @@ module Git
0
               if ip_family == "AF_INET6"
0
                 repository.cloned_from(ip)
0
               else
0
- localization = @geoip.country(ip)
0
+ geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat"))
0
+ localization = geoip.country(ip)
0
                 repository.cloned_from(ip, localization[3], localization[5])
0
               end
0
             else
0
@@ -120,7 +120,7 @@ module Git
0
           end
0
         end rescue Errno::EAGAIN
0
       else
0
- $stderr.puts "Invalid request: #{line}"
0
+ $stderr.puts "Invalid request from #{ip}: #{line}"
0
         session.close
0
         $children_active -= 1
0
       end

Comments

    No one has commented yet.