aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.lua2
-rw-r--r--net/dns.lua3
-rw-r--r--util/datamanager.lua12
3 files changed, 13 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index 3ea97ca4..7e41012c 100644
--- a/main.lua
+++ b/main.lua
@@ -24,6 +24,8 @@ do
end
end
+require "util.datamanager".set_data_path(config.get("*", "core", "data_path") or "data");
+
local server = require "net.server"
require "util.dependencies"
diff --git a/net/dns.lua b/net/dns.lua
index 7364161e..ea1d5d96 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -691,7 +691,8 @@ function resolver:pulse () -- - - - - - - - - - - - - - - - - - - - - pulse
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
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 80b35733..f25fffb3 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -17,6 +17,8 @@ local indent = function(f, i)
end
end
+local data_path = "data";
+
module "datamanager"
@@ -70,14 +72,18 @@ end
------- 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