Changeset

454:21105a005eef

Merge from waqas
author Matthew Wild <mwild1@gmail.com>
date Fri, 28 Nov 2008 18:06:29 +0000
parents 451:e9f269e5204e (current diff) 453:a1efb2cb4f9c (diff)
children 455:2eeae9c314b0 456:27cb85d4059e
files
diffstat 3 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main.lua	Fri Nov 28 00:08:23 2008 +0000
+++ b/main.lua	Fri Nov 28 18:06:29 2008 +0000
@@ -24,6 +24,8 @@
 	end
 end
 
+require "util.datamanager".set_data_path(config.get("*", "core", "data_path") or "data");
+
 local server = require "net.server"
 
 require "util.dependencies"
--- a/net/dns.lua	Fri Nov 28 00:08:23 2008 +0000
+++ b/net/dns.lua	Fri Nov 28 18:06:29 2008 +0000
@@ -691,7 +691,8 @@
           if not next (self.active) then  return nil  end
         else
           -- print ('retry', o.server, o.delay)
-          self.socket[o.server]:send (o.packet)
+          local _a = self.socket[o.server];
+          if _a then _a:send (o.packet) end
           o.retry = self.time + self.delays[o.delay]
           end  end  end  end
 
--- a/util/datamanager.lua	Fri Nov 28 00:08:23 2008 +0000
+++ b/util/datamanager.lua	Fri Nov 28 18:06:29 2008 +0000
@@ -17,6 +17,8 @@
 	end
 end
 
+local data_path = "data";
+
 module "datamanager"
 
 
@@ -70,14 +72,18 @@
 
 ------- API -------------
 
+function set_data_path(path)
+	data_path = path;
+end
+
 function getpath(username, host, datastore, ext)
 	ext = ext or "dat";
 	if username then
-		return format("data/%s/%s/%s.%s", encode(host), datastore, encode(username), ext);
+		return format("%s/%s/%s/%s.%s", data_path, encode(host), datastore, encode(username), ext);
 	elseif host then
-		return format("data/%s/%s.%s", encode(host), datastore, ext);
+		return format("%s/%s/%s.%s", data_path, encode(host), datastore, ext);
 	else
-		return format("data/%s.%s", datastore, ext);
+		return format("%s/%s.%s", data_path, datastore, ext);
 	end
 end