Changeset

7647:e9d7a409e236

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Wed, 31 Aug 2016 16:25:21 +0100
parents 7641:5eef792bb2e1 (current diff) 7646:6210dfaec84f (diff)
children 7649:c07f01869795
files core/moduleapi.lua core/storagemanager.lua plugins/mod_s2s/mod_s2s.lua
diffstat 3 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Tue Aug 30 17:54:24 2016 +0200
+++ b/core/moduleapi.lua	Wed Aug 31 16:25:21 2016 +0100
@@ -431,7 +431,7 @@
 end
 
 function api:measure_object_event(events_object, event_name, stat_name)
-	local m = self:measure(stat_name or event_name, "duration");
+	local m = self:measure(stat_name or event_name, "times");
 	local function handler(handlers, _event_name, _event_data)
 		local finished = m();
 		local ret = handlers(_event_name, _event_data);
--- a/core/storagemanager.lua	Tue Aug 30 17:54:24 2016 +0200
+++ b/core/storagemanager.lua	Wed Aug 31 16:25:21 2016 +0100
@@ -153,14 +153,19 @@
 		if err == "unsupported-store" then
 			if typ == "map" then -- Use shim on top of keyval store
 				log("debug", "map storage driver unavailable, using shim on top of keyval store.");
-				return create_map_shim(host, store);
+				ret, err = create_map_shim(host, store);
+			else
+				log("debug", "Storage driver %s does not support store %s (%s), falling back to null driver",
+					driver_name, store, typ or "<nil>");
+				ret, err = null_storage_driver, nil;
 			end
-			log("debug", "Storage driver %s does not support store %s (%s), falling back to null driver",
-				driver_name, store, typ or "<nil>");
-			ret = null_storage_driver;
-			err = nil;
 		end
 	end
+	if ret then
+		local event_data = { host = host, store_name = store, store_type = typ, store = ret };
+		prosody.hosts[host].events.fire_event("store-opened", event_data);
+		ret, err = event_data.store, event_data.store_err;
+	end
 	return ret, err;
 end
 
--- a/plugins/mod_s2s/mod_s2s.lua	Tue Aug 30 17:54:24 2016 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Wed Aug 31 16:25:21 2016 +0100
@@ -665,7 +665,6 @@
 			if s2sout.attempt_connection(session, err) then
 				return; -- Session lives for now
 			end
-			hosts[session.from_host].events.fire_event("s2s-connect-failure", { session = session, err = err });
 		end
 		(session.log or log)("debug", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err or "connection closed"));
 		s2s_destroy_session(session, err);