# HG changeset patch # User Matthew Wild # Date 1365419314 -3600 # Node ID e66973c81e89dcdbc3546b5f2dc9f9041571ccc6 # Parent 1994a4483b1c1e2e5597bf0aa25648f0f70544ef# Parent 6a5c622cc6d444eb811857960ccbf678d3ab8da2 Merge 0.9->trunk diff -r 1994a4483b1c -r e66973c81e89 net/http/server.lua --- a/net/http/server.lua Sat Apr 06 12:21:01 2013 +0100 +++ b/net/http/server.lua Mon Apr 08 12:08:34 2013 +0100 @@ -284,6 +284,9 @@ function _M.set_default_host(host) default_host = host; end +function _M.fire_event(event, ...) + return events.fire_event(event, ...); +end _M.listener = listener; _M.codes = codes; diff -r 1994a4483b1c -r e66973c81e89 prosodyctl --- a/prosodyctl Sat Apr 06 12:21:01 2013 +0100 +++ b/prosodyctl Mon Apr 08 12:08:34 2013 +0100 @@ -51,6 +51,7 @@ lock_globals = function () end; unlock_globals = function () end; installed = CFG_SOURCEDIR ~= nil; + core_post_stanza = function () end; -- TODO: mod_router! }; _G.prosody = prosody; diff -r 1994a4483b1c -r e66973c81e89 util/datamanager.lua --- a/util/datamanager.lua Sat Apr 06 12:21:01 2013 +0100 +++ b/util/datamanager.lua Mon Apr 08 12:08:34 2013 +0100 @@ -187,17 +187,25 @@ -- save the datastore local d = "return " .. serialize(data) .. ";\n"; - local ok, msg = atomic_store(getpath(username, host, datastore, nil, true), d); - if not ok then - log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); - return nil, "Error saving to storage"; - end - if next(data) == nil then -- try to delete empty datastore - log("debug", "Removing empty %s datastore for user %s@%s", datastore, username or "nil", host or "nil"); - os_remove(getpath(username, host, datastore)); - end - -- we write data even when we are deleting because lua doesn't have a - -- platform independent way of checking for non-exisitng files + local mkdir_cache_cleared; + repeat + local ok, msg = atomic_store(getpath(username, host, datastore, nil, true), d); + if not ok then + if not mkdir_cache_cleared then -- We may need to recreate a removed directory + _mkdir = {}; + mkdir_cache_cleared = true; + else + log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); + return nil, "Error saving to storage"; + end + end + if next(data) == nil then -- try to delete empty datastore + log("debug", "Removing empty %s datastore for user %s@%s", datastore, username or "nil", host or "nil"); + os_remove(getpath(username, host, datastore)); + end + -- we write data even when we are deleting because lua doesn't have a + -- platform independent way of checking for non-exisitng files + until ok; return true; end @@ -354,4 +362,6 @@ return #errs == 0, t_concat(errs, ", "); end +_M.path_decode = decode; +_M.path_encode = encode; return _M;