summaryrefslogtreecommitdiffstats
path: root/script/git-daemon
diff options
context:
space:
mode:
authorJohan Sørensen <johan@johansorensen.com>2009-06-03 12:40:57 +0200
committerJohan Sørensen <johan@johansorensen.com>2009-06-03 15:04:49 +0200
commit09d09243b5e2c546a84b9cc49ab3b9f14ae5d06e (patch)
treec6a9d78524d3523d432fca681b3a77032223fa95 /script/git-daemon
parent3a811a9d41f701560976f237afbb45f0857a09af (diff)
downloadgitorious-mainline-outdated-09d09243b5e2c546a84b9cc49ab3b9f14ae5d06e.zip
gitorious-mainline-outdated-09d09243b5e2c546a84b9cc49ab3b9f14ae5d06e.tar.gz
gitorious-mainline-outdated-09d09243b5e2c546a84b9cc49ab3b9f14ae5d06e.tar.bz2
Monkeypatch GeoIP so we can close its file handles
The GeoIP currently doesn't offer a #close method or a block form of opening the database file, hence it leaves behind an open filehandle whenever it's used
Diffstat (limited to 'script/git-daemon')
-rwxr-xr-xscript/git-daemon7
1 files changed, 7 insertions, 0 deletions
diff --git a/script/git-daemon b/script/git-daemon
index fc4c3f1..5cab0ef 100755
--- a/script/git-daemon
+++ b/script/git-daemon
@@ -22,6 +22,12 @@ MAX_CHILDREN = 30
$children_reaped = 0
$children_active = 0
+class GeoIP
+ def close
+ @file.close
+ end
+end
+
module Git
class Daemon
include Daemonize
@@ -117,6 +123,7 @@ module Git
else
geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat"))
localization = geoip.country(ip)
+ geoip.close
repository.cloned_from(ip, localization[3], localization[5], 'git')
end