Changeset

5349:0d11e393201f

s2smanager: Use unused local, reduce table indexing
author Kim Alvefur <zash@zash.se>
date Wed, 13 Mar 2013 07:33:36 +0100
parents 5348:ca0d820e9318
children 5350:fba042a2c228
files core/s2smanager.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/core/s2smanager.lua	Wed Mar 13 07:03:34 2013 +0100
+++ b/core/s2smanager.lua	Wed Mar 13 07:33:36 2013 +0100
@@ -12,7 +12,6 @@
 local tostring, pairs, ipairs, getmetatable, newproxy, setmetatable
     = tostring, pairs, ipairs, getmetatable, newproxy, setmetatable;
 
-local fire_event = prosody.events.fire_event;
 local logger_init = require "util.logger".init;
 
 local log = logger_init("s2smanager");
@@ -23,6 +22,7 @@
 incoming_s2s = {};
 prosody.incoming_s2s = incoming_s2s;
 local incoming_s2s = incoming_s2s;
+local fire_event = prosody.events.fire_event;
 
 module "s2smanager"
 
@@ -91,7 +91,7 @@
 
 	local event_data = { session = session };
 	if session.type == "s2sout" then
-		prosody.events.fire_event("s2sout-established", event_data);
+		fire_event("s2sout-established", event_data);
 		hosts[from].events.fire_event("s2sout-established", event_data);
 	else
 		local host_session = hosts[to];
@@ -99,7 +99,7 @@
 			return host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza });
 		end;
 
-		prosody.events.fire_event("s2sin-established", event_data);
+		fire_event("s2sin-established", event_data);
 		hosts[to].events.fire_event("s2sin-established", event_data);
 	end
 	
@@ -158,12 +158,12 @@
 	
 	local event_data = { session = session, reason = reason };
 	if session.type == "s2sout" then
-		prosody.events.fire_event("s2sout-destroyed", event_data);
+		fire_event("s2sout-destroyed", event_data);
 		if hosts[session.from_host] then
 			hosts[session.from_host].events.fire_event("s2sout-destroyed", event_data);
 		end
 	elseif session.type == "s2sin" then
-		prosody.events.fire_event("s2sin-destroyed", event_data);
+		fire_event("s2sin-destroyed", event_data);
 		if hosts[session.to_host] then
 			hosts[session.to_host].events.fire_event("s2sin-destroyed", event_data);
 		end