mod_s2s: Index session after checking if it exists (fixes traceback in case of a connection without a session having a read timeout)
authorKim Alvefur <zash@zash.se>
Sun, 07 Aug 2016 20:48:37 +0200
changeset 7540 a0813737c6fa
parent 7536 4ef37ac69562
child 7541 a3a4ed0d34f4
mod_s2s: Index session after checking if it exists (fixes traceback in case of a connection without a session having a read timeout)
plugins/mod_s2s/mod_s2s.lua
--- a/plugins/mod_s2s/mod_s2s.lua	Fri Jul 29 13:20:02 2016 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Sun Aug 07 20:48:37 2016 +0200
@@ -642,8 +642,8 @@
 
 function listener.onreadtimeout(conn)
 	local session = sessions[conn];
-	local host = session.host or session.to_host;
 	if session then
+		local host = session.host or session.to_host;
 		return (hosts[host] or prosody).events.fire_event("s2s-read-timeout", { session = session });
 	end
 end