Software /
code /
prosody
Changeset
6423:1c78f10f05d0
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 23 Sep 2014 01:44:16 +0200 |
parents | 6419:84b332eacde9 (current diff) 6422:6d4d87a89026 (diff) |
children | 6428:3ee09bfe16e1 |
files | core/moduleapi.lua |
diffstat | 3 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/core/moduleapi.lua Tue Sep 16 17:11:29 2014 -0400 +++ b/core/moduleapi.lua Tue Sep 23 01:44:16 2014 +0200 @@ -390,7 +390,9 @@ return require"core.storagemanager".open(self.host, name or self.name, type); end -return function (mm) +function api.init(mm) modulemanager = mm; return api; end + +return api;
--- a/core/modulemanager.lua Tue Sep 16 17:11:29 2014 -0400 +++ b/core/modulemanager.lua Tue Sep 23 01:44:16 2014 +0200 @@ -37,7 +37,7 @@ module "modulemanager" -local api = _G.require "core.moduleapi"(_M); -- Module API container +local api = _G.require "core.moduleapi".init(_M); -- Module API container -- [host] = { [module] = module_env } local modulemap = { ["*"] = {} };
--- a/util/random.lua Tue Sep 16 17:11:29 2014 -0400 +++ b/util/random.lua Tue Sep 23 01:44:16 2014 +0200 @@ -10,7 +10,7 @@ local os_time = os.time; local os_clock = os.clock; local ceil = math.ceil; -local sha1 = require "util.hashes".sha1; +local H = require "util.hashes".sha512; local last_uniq_time = 0; local function uniq_time() @@ -21,7 +21,7 @@ end local function new_random(x) - return sha1(x..os_clock()..tostring({})); + return H(x..os_clock()..tostring({})); end local buffer = new_random(uniq_time()); @@ -31,8 +31,8 @@ end local function bytes(n) - if #buffer < n then seed(uniq_time()); end - local r = buffer:sub(0, n); + if #buffer < n+4 then seed(uniq_time()); end + local r = buffer:sub(1, n); buffer = buffer:sub(n+1); return r; end